缺省的CToolBar的在浮动的状态下,右键菜单(contex)显示。
在英文版的软件按装在中文哦系统下,显示的是中文菜单。或者想去掉该右键菜单。方法如下
重载 ONLBUTTONCLICK and ONLBUTONDBCLICK
void CWapTooBar::OnLButtonDblClk(UINT nFlags, CPoint point)
{
//父类操作
CToolBar::OnLButtonDblClk(nFlags, point);
if (IsFloating()) //is toolbar floating
{
CWnd* pMiniFrame;
CWnd* pDockBar;
pDockBar = GetParent();
pMiniFrame = pDockBar->GetParent();
CMenu* pMenu = pMiniFrame->GetSystemMenu(FALSE);
WORD langID = MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US);
if(langID == GetThreadLocale())
{//英文版
pMenu->ModifyMenu(SC_MOVE, MF_BYCOMMAND|MF_STRING,MF_BYCOMMAND|SC_MOVE, "Move(&M)");
pMenu->ModifyMenu(SC_CLOSE, MF_BYCOMMAND|MF_STRING,MF_BYCOMMAND|SC_CLOSE, "Hide(&H)");
}
//extreme way of re-painting the toolbar
pMiniFrame->ShowWindow(SW_HIDE);
pMiniFrame->ShowWindow(SW_SHOW);
}
}
void CWapTooBar::OnLButtonDown(UINT nFlags, CPoint point)
{
CToolBar::OnLButtonDown(nFlags, point);
if (IsFloating()) //is toolbar floating
{
CWnd* pMiniFrame;
CWnd* pDockBar;
pDockBar = GetParent();
pMiniFrame = pDockBar->GetParent();
CMenu* pMenu = pMiniFrame->GetSystemMenu(FALSE);
WORD langID = MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US);
if(langID == GetThreadLocale())
{//英文版
pMenu->ModifyMenu(SC_MOVE, MF_BYCOMMAND|MF_STRING,MF_BYCOMMAND|SC_MOVE, "Move(&M)");
pMenu->ModifyMenu(SC_CLOSE, MF_BYCOMMAND|MF_STRING,MF_BYCOMMAND|SC_CLOSE, "Hide(&H)");
}
pMiniFrame->ShowWindow(SW_HIDE);
pMiniFrame->ShowWindow(SW_SHOW);
}
}