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,0x2);    
        FreeLibrary(hInst); 

我只知道上面着一种方法,现在不能满足我的程序需求,有没有另外一种方法呢?

解决方案 »

  1.   

    CPoint point;
    CRgn rgn,tmp;
    CRect rc;
    m_Static.GetWindowRect(&rc);
    rgn.CreateRectRgn(0,0,rc.Width()-1,rc.Height()-1);for(point.x = 0 ; point.x <= rc.Width();point.x++)

      for(point.y = 0 ; point.y <= rc.Height();point.y++)
      { 
         if(rc.PtlnRect(point))
         {
            tmp.CreateRectRgn(point.x,point.y,point.x+1,point.y+1);
            rgn.CombineRgn(&rgn,&tmp,RGN_XOR);
            tmp.DeleteObject();
          }
       }
    }
    SetWindowRgn((HRGN)rgn,TRUE);
      

  2.   

    if(rc.PtlnRect(point)) 为PtInRect(point)刚打错了