How to achieve transparent windows

xiaoxiao2021-03-06  108

VC realize how transparent window select from the Blog leisureful picture-transparent interface, the following method is applicable only WINDOWS2000 and XP systems: Add in the dialog box initialization function:?? #Define LWA_COLORKEY 0x00000001 #define WS_EX_LAYERED 0x00080000 typedef BOOL (WINAPI * lpfnSetLayeredWindowAttributes ) (HWND hWnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags); lpfnSetLayeredWindowAttributes SetLayeredWindowAttributes; // disposed edges of the transparent COLORREF maskColor = RGB (0,255,0); HMODULE hUser32 = GetModuleHandle ( "user32.dll"); SetLayeredWindowAttributes = (lpfnSetLayeredWindowAttributes ) GetProcAddress (hUser32, "SetLayeredWindowAttributes"); SetWindowLong (GetSafeHwnd (), GWL_EXSTYLE, GetWindowLong (GetSafeHwnd (), GWL_EXSTYLE) │ WS_EX_LAYERED);?? SetLayeredWindowAttributes (GetSafeHwnd (), maskColor, 255, LWA_COLORKEY); FreeLibrary (hUser32); Where MaskColor is a transparent color, that is, what color zone is set to transparent

Author Blog:

http://blog.9cbs.net/leisureful/

转载请注明原文地址:https://www.9cbs.com/read-97752.html

New Post(0)