背景介绍
以CDialog或者其子类实现的某个图标组件,可响应鼠标点击事件。但是会出现某些情况下,点击不起效的情况。
解决方法
重写OnMouseActivate
函数,调用你想要的行为即可。
int 你的类名(上面说的某个图标组件-继承自CDialog或其子类)::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT msg)
{
此处调用你想要鼠标点击后发生的具体行为。
return __super::OnMouseActivate(pDesktopWnd, nHitTest, msg);
}
OnMouseActivate介绍
原文链接: OnMouseActivate
The framework calls this member function when the cursor is in an inactive window and the user presses a mouse button.