对话框透明

////////////////////////以下实现窗体的透明///////////////////////////////////      
 
  SetWindowLong(this->GetSafeHwnd(),GWL_EXSTYLE,          
  GetWindowLong(this->GetSafeHwnd(),GWL_EXSTYLE)^0x80000);      
  HINSTANCE hInst = LoadLibrary("User32.DLL");       
  if(hInst)           
  {           
      typedef BOOL (WINAPI *MYFUNC)(HWND,COLORREF,BYTE,DWORD);           
      MYFUNC fun = NULL;          
      //取得SetLayeredWindowAttributes函数指针           
      fun=(MYFUNC)GetProcAddress(hInst, "SetLayeredWindowAttributes");          
      if(fun)fun(this->GetSafeHwnd(),0,128,2);   
      Invalidate();  
      FreeLibrary(hInst);           
  }  
 
////////////////////////以上实现窗体的透明///////////////////////////////////
posted on 2011-01-31 15:24  carekee  阅读(272)  评论(0编辑  收藏  举报