qintangtao

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

//主要两个步骤:
//第一个步骤就是在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;
}

 

posted on 2013-08-25 23:18  qintangtao  阅读(442)  评论(0编辑  收藏  举报