15,979
社区成员
发帖
与我相关
我的任务
分享
BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if(WM_MOUSEMOVE == pMsg->message)
{
CPoint pt;
GetCursorPos(&pt);
HWND hWnd = ::WindowFromPoint(pt);
if(NULL != hWnd)
{
TCHAR szClassName[MAX_PATH] = {0};
GetClassName(hWnd, szClassName, _countof(szClassName));
TCHAR szMenu[MAX_PATH] = {0};
GetClassName(m_wndMenuBar.GetSafeHwnd(), szMenu, _countof(szMenu));
CString strText;
strText.Format(_T("%s === %s"), szClassName, szMenu);
SetWindowText(strText);
if(0 != _tcscmp(szClassName, szMenu))
{
ScreenToClient(&pt);
PostMessage(WM_LBUTTONDOWN, MAKEWPARAM(pt.x, pt.y), 0);
}
}
}
return CMDIFrameWndEx::PreTranslateMessage(pMsg);
}
试试这样行不?可能效果不太好~