Created
October 7, 2010 10:04
-
-
Save yoggy/614911 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void SetWindowTransparent(HWND hWnd, unsigned char alpha) | |
{ | |
BOOL (*pSetLayeredWindowAttributes)(HWND, COLORREF, BYTE, DWORD) = NULL; | |
HMODULE hDll = LoadLibrary(_T("\\Windows\\coredll.dll")); | |
pSetLayeredWindowAttributes = (BOOL (*)(HWND, COLORREF, BYTE, DWORD))GetProcAddress(hDll, _T("SetLayeredWindowAttributes")); | |
LONG style = GetWindowLong(hWnd, GWL_EXSTYLE); | |
SetWindowLong(hWnd, GWL_EXSTYLE, style | WS_EX_LAYERED); | |
pSetLayeredWindowAttributes(hWnd, 0, alpha, LWA_ALPHA); | |
FreeLibrary(hDll); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment