Omnimaga
General Discussion => Technology and Development => Computer Projects and Ideas => Topic started by: Netham45 on June 24, 2011, 01:44:49 am
-
Just made this nifty program that makes RDP somewhat more seamless to the host desktop. It's really small, and pretty much complete for what I'm going to do with it.
What I'm doing to make it work is this: Set the wallpaper on the client to 77,77,77 RGB, and set that as the RDP window's transparency key.
Known bugs: 77,77,77 RGB requires 24-bit color depth
Attached is the a bin.
Doesn't relate to calcs, but it's still nifty. :P
Edit: SCREENSHOT!
EDIT2: No need for the entire project. Here's the source in entirety (Set as multi-byte in project properties):
#include <windows.h>
#include <iostream>
#include <Psapi.h>
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam);
//Defining these obviously local vars as global so they don't get re-defined every time. Trying to speed shit up.
COLORREF getColor = RGB(0,0,0);
COLORREF transKey = RGB(77,77,77);
unsigned char alpha = 0;
const unsigned char unfocused = 180;
const unsigned char focused = 255;
HWND hwndCurrent;
TCHAR WindowTitle[MAX_PATH] = "";
int main()
{
printf("Press CTRL+C to quit\n");
while(true)
{
EnumWindows(EnumWindowsProc, 0);
Sleep(20);
}
}
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam) {
GetWindowText(hwnd, WindowTitle, sizeof(WindowTitle));
if (strstr(WindowTitle,"- Remote Desktop Connection"))
{
if (!GetLayeredWindowAttributes(hwnd,&getColor,&alpha,NULL)) SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED);
if (GetForegroundWindow() != hwnd)
{
if (alpha != unfocused) SetLayeredWindowAttributes(hwnd,transKey,unfocused,LWA_COLORKEY + LWA_ALPHA);
}
else if (alpha != focused) SetLayeredWindowAttributes(hwnd,transKey,focused,LWA_COLORKEY + LWA_ALPHA);
}
return true;
}
Edit3:
Here's a lite version. run it once on launch. Bin attached.
#include <windows.h>
#include <iostream>
#include <Psapi.h>
BOOL CALLBACK EnumWindowsProcess(HWND hwnd, LPARAM lParam);
const COLORREF transKey = RGB(77,77,77);
int main()
{
EnumWindows(EnumWindowsProcess, 0);
}
BOOL CALLBACK EnumWindowsProcess(HWND hwnd, LPARAM lParam)
{
TCHAR WindowTitle[MAX_PATH] = "";
GetWindowText(hwnd, WindowTitle, sizeof(WindowTitle));
if (strstr(WindowTitle,"- Remote Desktop Connection") && !GetLayeredWindowAttributes(hwnd,NULL,NULL,NULL))
{
SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED);
SetLayeredWindowAttributes(hwnd,transKey,255,LWA_COLORKEY + LWA_ALPHA);
}
return true;
}
Edit4:
Performance is awful when Aero is disabled on the host.
-
Nifty indeed :D
-
This seems pretty awesome :D It's seemless to the point it's integrated in our desktop :)