我有一个小型 SDI 应用程序,我正在尝试添加对菜单使用情况的跟踪,即。用户选择某些菜单项的次数。
一些菜单项由 View 组件 (DemoView.cpp) 处理,而其他菜单项由主应用程序 (DemoApp.cpp) 处理。Since the tracking structure is defined in the main app, I believe that I have to notify the View's parent with a special message when a menu item (handled by the View) is selected.
如果这是正确的,我的问题是我无法创建正确的 ON_MESSAGE 命令。它看起来像这样:
ON_MESSAGE(WM_INCREASE_FREQ, &CDemoApp::OnIncreaseFreq)
其中 OnIncreaseFreq() 定义如下:
LRESULT CDemoApp::OnIncreaseFreq(WPARAM, LPARAM)
但是我收到此错误:
error C2440: 'static_cast' : cannot convert from
'LRESULT (__thiscall CDemoApp::* )(WPARAM,LPARAM)' to
'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)'
我将不胜感激