- void SetWindowAlpha(HWND hWnd,BYTE nValue){
- HINSTANCE hInst;
- const LWA_COLORKEY = 0x00001;
- const LWA_ALPHA = 0x00002;
- const WS_EX_LAYERED = 0x80000;
- ASSERT(hWnd != NULL);
- ::SetWindowLong(GetSafeHwnd(),GWL_EXSTYLE,GetWindowLong(GetSafeHwnd(),GWL_EXSTYLE)|WS_EX_LAYERED);
- typedef BOOL (WINAPI *LPFNSetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD);
- LPFNSetLayeredWindowAttributes SetLayeredWindowAttributes;
- hInst = LoadLibrary("User32.dll");
- SetLayeredWindowAttributes = (LPFNSetLayeredWindowAttributes)
- GetProcAddress(hInst,"SetLayeredWindowAttributes");
- if(SetLayeredWindowAttributes)
- SetLayeredWindowAttributes(hWnd,RGB(0,0,0),nValue,LWA_ALPHA);
- FreeLibrary(hInst);
- }
vc 窗体透明度
最新推荐文章于 2021-02-24 17:58:32 发布