问题描述
我有一个带有 ComboBox 的 WinForms C# 应用程序,该应用程序订阅 SelectedIndexChanged(或 SelectionChangeCommitted)事件。当所选项目以“正常方式”更改时,这很有效,但是当我使用 P/Invoke 和 Win32 API 从另一个应用程序更改它时,我没有收到事件(但我可以看到所选项目正在更改)。有人知道我该如何解决这个问题吗?
private const int CB_SETCURSEL = 0x14E;
[DllImport("user32.dll")]
public static extern IntPtr SendMessage(IntPtr hWnd,int Msg,int wParam,ref int lParam);
int lParam = 0;
SendMessage(hWnd,CB_SETCURSEL,5,ref lParam); // Select item 5 in ComboBox. Doesn't trigger
// SelectedIndexChanged event in the other application!!!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)