void CMainFrame::ShowCaptionMenu(BOOL bShow)
{
static HMENU hMenu=NULL;
if (hMenu == NULL){
hMenu=::GetMenu(this->GetSafeHwnd());
}
if(bShow){
::SetMenu(this->GetSafeHwnd(),hMenu);
this->ModifyStyle(0,WS_CAPTION,SWP_FRAMECHANGED);
}else{
::SetMenu(this->GetSafeHwnd(),NULL);
this->ModifyStyle(WS_CAPTION,0,SWP_FRAMECHANGED);
}
}
调用:
this->ShowCaptionMenu(FALSE);
this->ShowCaptionMenu(TRUE);