现在,我有一个实现“IMessageFilter”的类,它将所选消息(WM _KEYDOWN、WM _LBUTTONDOWN等)保存到列表中。
在“暂停/中断”键上,我复制消息列表,清除原始列表,然后重新发送消息。
在我的测试项目中,只有一个表单,有一个菜单项、一个选项卡和一个richtextbox。在保存和重复消息期间,控件的hWnd是相同的。
一切正常,但发送消息没有效果:/。
[System.Runtime.InteropServices.DllImport( "user32" )]
public static extern int SendMessage( IntPtr hwnd, int msg, IntPtr wparam, IntPtr lparam );
// ... in some method ...
SendMessage( msg.HWnd, msg.Msg, msg.WParam, msg.LParam );