Required function Prototypes: BOOL WINAPI SetLayeredWindowAttributes (HWND hwnd, Colorrefcrkey, BYTE Balpha, DWORD flag);
Parameter meaning:
HWnd: The handle of the window to be set.
Flag: Transparent mode, two values are desirable: Lwa_colorkey (whose value is defined as 0x1) and Lwa_alpha (whose value is defined as 0x2). The combination of the two is desirable.
Crkey: Mask color, when the flag value is Lwa_colorkey, the place where the color value in the window is equal to Crkey becomes fully transparent. Otherwise, this parameter is not valid.
Balpha: The transparency of the window, the value range 0~255. Valid when flag contains the Lwa_alpha logo.
Calling Methods in MFC: SetLayeredWindowAttributes (M_hwnd, RGB (0, 0, 0), $, 0x1 | 0x2);
Note that in VC6.0, the header file does not have the declaration of this function, so you can only load the DLL module containing this function in the following way, and then look for the function entry address and then call it.
Hmodule hInst = LoadLibrary ("user32.dll");
if (hInst)
{
typedef BOOL (Winpai*setalpha) (HWND, COLORREF, BYTE, DWORD); Defining function pointer types
Setalpha Setalpha = (setalpha) GetProcAddress (HInst, "setlayeredwindowattributes");
if (Setalpha)
Setalpha (m_hwnd, RGB (0, 0, 0), $, 0x1 | 0x2);
FreeLibrary (HInst);
}
http://blog.csdn.net/yjwffgip456/article/details/43968247
Set Windows window translucency (using SetLayeredWindowAttributes API functions)