CSDN博客

img uaiia

让你的窗口透明起来

发表于2001/1/18 15:22:00  909人阅读


#define WS_EX_LAYERED           0x00080000
#define LWA_COLORKEY            0x00000001
#define LWA_ALPHA               0x00000002

typedef BOOL (*_SetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD);
_SetLayeredWindowAttributes SetLayeredWindowAttributes;

void SetLayered(HWND hWnd,int Pos)
{
 SetLayeredWindowAttributes = (_SetLayeredWindowAttributes)GetProcAddress(GetModuleHandle("user32.dll"),"SetLayeredWindowAttributes");
 if ( SetLayeredWindowAttributes == NULL )
  return ;
 else{
   __try{
    SetWindowLong(hWnd,GWL_EXSTYLE,GetWindowLong(hWnd,GWL_EXSTYLE)|WS_EX_LAYERED);
    SetLayeredWindowAttributes(hWnd,RGB(0,0,0),Pos,LWA_ALPHA);
   }
   __except(EXCEPTION_EXECUTE_HANDLER){
    AfxMessageBox("SYSTEM FALSE");
   }
 }
}

0 0

相关博文

我的热门文章

img
取 消
img