【发布时间】:2012-11-05 19:58:55
【问题描述】:
我正在尝试向应用程序发送鼠标点击。
我目前有:
int hWnd = FindWindow(null, "Window Title Here");
SendMessage(hwnd, 0x201, 0, 0); //Mouse left down
SendMessage(hwnd, 0x202, 0, 0); //Mouse left up
我正在使用
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)]
static extern IntPtr SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
和
[DllImportAttribute("User32.dll")]
private static extern int FindWindow(String ClassName, String WindowName);
但我得到错误,这些是:
“当前上下文中不存在名称‘hwnd’”
我该如何解决这个问题?
【问题讨论】:
标签: c# process mouseevent message send