Since I don’t really like the default caption bars of XP, I wanted to implement a custom looking titlebar for Win2000, OfficeXP, Office2003
themes that adapts to the current caption colors, so I looked through your skinning code, and wrote my custom looking titlebar&borders based on that.
As I was testing my version of CExtNcFrameImpl with CMDIFrameWnd and CMDIChildWnd I have some suggestions for you:
In the NcFrameImpl_PreWindowProc you need:
case WM_NCACTIVATE:
if(pWndFrameImpl->IsKindOf(RUNTIME_CLASS(CMDIChildWnd)))
{
m_bIsActive = wParam == TRUE;
pWndFrameImpl->SendMessage(WM_NCPAINT);
}
lResult = 1;
return true;
case WM_MDIACTIVATE:
m_bIsActive = (HWND)lParam == GetFrameWindow()->m_hWnd; // Undocumented part
GetFrameWindow()->SendMessage(WM_NCPAINT);
break;
case WM_ACTIVATEAPP:
if( wParam == 0 )
m_bIsActive = false;
else
m_bIsActive = IsActive();
pWndFrameImpl->SendMessage( WM_NCPAINT );
if(pWndFrameImpl->IsKindOf(RUNTIME_CLASS(CMDIFrameWnd)))
{
CMDIFrameWnd* pMDIFrameWnd = (CMDIFrameWnd*)pWndFrameImpl;
CMDIChildWnd* pMDIChildWnd = pMDIFrameWnd->MDIGetActive();
if(pMDIChildWnd)
pMDIChildWnd->SendMessage(WM_NCACTIVATE, m_bIsActive ? TRUE:FALSE);
}
break;
In the NcRameImpl_PostWindowProc you need a
case WM_SYSCOMMAND:
if(wParam == SC_MINIMIZE)
GetFrameWindow()->SendMessage(WM_NCPAINT);
break;
in case an MDI child window is minimized -> no default nc buttons appear.
My GetFrameWindow() is implemented as a virtual function, and in the template class it returns "this", so I can use IsKindOf().
Best regards,
Gergely Bacso