BOOL SetTransparent(HWND hWnd)
{
HMODULE hModule =GetModuleHandle("User32.DLL");
if(hModule == NULL)
{
return FALSE;
}
typedef BOOL (WINAPI* SETLAYEREDWND)( HWND, COLORREF, BYTE, DWORD);
SETLAYEREDWND SetLayeredWindowPtr = NULL;
SetLayeredWindowPtr = (SETLAYEREDWND)GetProcAddress(hModule, "SetLayeredWindowAttributes");
if(SetLayeredWindowPtr)
{
LONG lStyle = GetWindowLong(hWnd, GWL_EXSTYLE) | 0x00080000;
SetWindowLong( hWnd, GWL_EXSTYLE, lStyle);
SetLayeredWindowPtr( hWnd,
RGB(0, 0, 0),
BYTE((255 * 70) / 100),
2);
}
}
延伸阅读
文章来源于领测软件测试网 https://www.ltesting.net/










