|
一段使窗口透明的代码(仅适用于2000)
| 【字体:大
中 小】
|
整理日期:2006-2-18 0:00:00
|
【打印本文】
【收藏此文】 |
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); } }
|
|
|
|
|