

So there is no need to override OnNcPaint, you can do all of the painting in OnPaint void CMainFrame::OnPaint()

When using DwmExtendFrameIntoClientArea, it means frame is extended in to client area. I want to remove the unknown title bar without any side effect.ĭoes anyone could provide me a good solution or suggestion? Furthermore, my program cannot capture the minimum, maximum and the close button message on my custom caption bar anymore. If I remove WS_THICKFRAME, the unknown cation bar will disappear, but I cannot resizing the border of my window. I found out the unknown caption is caused by WS_THICKFRAME in the cs.style. However, my window appears another unknown caption title bar under Windows 10. TRACE0("Failed in DwmExtendFrameIntoClientArea\n") ĭc->FillSolidRect(0,0,RECTWIDTH(rcClient),RECTHEIGHT(rcClient),RGB(255,0,0)) ĬPaintDC gdc(this) // device context for painting HRESULT hr = DwmExtendFrameIntoClientArea(m_hWnd, &margins) Void CMainFrame::OnActivate(UINT nState,CWnd* pWndOther,BOOL bMinimized )ĬFrameWnd::OnActivate(nState,pWndOther,bMinimized) TODO: Modify the Window class or styles here by modifyingĬs.style = WS_CAPTION | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_OVERLAPPED| WS_SYSMENU | WS_THICKFRAME If (result = HTNOWHERE & GetForegroundWindow() != this)īOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) If (!DwmDefWindowProc(m_hWnd, WM_NCHITTEST, 0, MAKELPARAM(p.x, p.y), &result)) LRESULT CMainFrame::OnNcHitTest(CPoint p) Void CMainFrame::OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS* lpncsp) M_pLogoImage = m_pLogoImage->FromFile ( CT2CW(szLogoPath) ) PathAppend ( szLogoPath, _T("lena.bmp") ) GetModuleFileName ( GetModuleHandle(NULL), szLogoPath, _countof(szLogoPath) ) If (SUCCEEDED(DwmIsCompositionEnabled(&fDwmEnabled))) GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL) Gdiplus::GdiplusStartupInput gdiplusStartupInput In order to draw the icon on the caption title bar, I have refereed this MSDN article and used DWM API to create my customize client area by calling DwmExtendFrameIntoClientArea.
