您的位置:首页 > 其它

WIN7或者WIN8上边框的异常问题的解决攻略

2013-08-25 23:18 225 查看
//主要两个步骤:
//第一个步骤就是在CMainFrame::OnCreate里面增加

HINSTANCE hInst = LoadLibrary(_T("UxTheme.dll"));
if (hInst)
{
typedef HRESULT (WINAPI *PFUN_SetWindowTheme)(HWND, LPCTSTR, LPCTSTR);
PFUN_SetWindowTheme pFun = (PFUN_SetWindowTheme)GetProcAddress(hInst, "SetWindowTheme");
if (pFun)
{
pFun(m_hWnd, _T(""), _T("")); //去掉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);
}


//然后就是添加WM_NCACTIVATE添加消息响应函数:

BOOL CMainFrame::OnNcActivate(BOOL bActive)
{
BOOL bRet = CWnd::OnNcActivate(bActive);
SendMessage(WM_NCPAINT, 0, 0);
Invalidate();
return bRet;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐