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,150,2);
  FreeLibrary(hInst);
 } 

//说明:
1.增加WS_EX_LAYERED窗口风格,值为80000
2.在头文件第一行定义#define _WIN32_WINNT 0x500

3. SetLayeredWindowAttributes(
    hWnd,
    0,//颜色值。
    150,//透明深度 0-为完全透明,255-为不透明
    ULW_ALPHA);//参数,表示透明效果。为1,表示对单种颜色透明
posted on 2006-05-19 17:23  泡泡  阅读(396)  评论(0编辑  收藏  举报