本文主题是简单介绍通过SendMessage来模拟部分用户输入。
1,发送CBN_SELCHANGE消息
WPARAM wParam = MAKEWPARAM( IDC_SYSTEM_SELECT, CBN_SELCHANGE );
::SendMessage( this-> m_hWnd, WM_COMMAND, wParam, (LPARAM)(((CComboBox*)GetDlgItem(IDC_SYSTEM_SELECT))-> m_hWnd));
说明:
IDC_SYSTEM_SELECT:控件ID
消息对应的回调函数ON_CBN_SELCHANGE(IDC_SYSTEM_SELECT, OnSelChangeSystemSelect)
执行SendMessage之后,对应的回调函数就会执行。
-----------------
可以参考MFC中的WM_COMMAND说明:
LRESULT CALLBACK WindowProc(
HWND hwnd, // handle to window
WM_COMMAND, // the message to send
WPARAM wParam, // notification code and identifier
LPARAM lParam // handle to control (HWND)
);
未完待续……