int CDBFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
    {
        if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
            return -1;
   
        ModifyStyle(WS_CAPTION, 0);    //没有这行,最大化的时候有窗口边缘8像素的被截掉了
   
        HINSTANCE hInst = LoadLibrary(_T("UxTheme.dll"));
        if (hInst)
        {
            typedef HRESULT (WINAPI *PFUN_SetWindowTheme)(HWND, LPCWSTR, LPCWSTR);
           
            PFUN_SetWindowTheme pFun = (PFUN_SetWindowTheme)GetProcAddress(hInst, "SetWindowTheme");
   
            if (pFun)
                pFun(GetSafeHwnd(), L"", L"");        //去掉xp主题
   
            FreeLibrary(hInst);
        }
   
        hInst = LoadLibrary(_T("dwmapi.dll"));
        if (hInst)
        {
            typedef HRESULT (WINAPI * TmpFun)(HWND,DWORD,LPCVOID,DWORD);
            TmpFun DwmSetWindowAttributeEX = (TmpFun)::GetProcAddress(hInst, "DwmSetWindowAttribute");
           
            if (DwmSetWindowAttributeEX)
            {
                DWORD dwAttr = 1;
                DwmSetWindowAttributeEX(GetSafeHwnd(), 2, &dwAttr, 4);    //去掉vista特效
            }
   
            FreeLibrary(hInst);
        }
    }

 

    BOOL CDBFrame::OnNcActivate( BOOL bActive )        //避免每次激活时vista重画边框
    {
        return TRUE;
    }

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-11
  • 2021-07-16
  • 2021-06-15
  • 2021-08-19
  • 2022-12-23
  • 2021-07-31
猜你喜欢
  • 2021-12-08
  • 2021-12-06
  • 2022-12-23
  • 2022-12-23
  • 2021-08-24
  • 2021-08-27
  • 2022-12-23
相关资源
相似解决方案