[英]Send mouse click to process
I'm trying to accomplish sending a mouse click to a application. 我正在尝试将鼠标单击发送到应用程序。
I currently have: 我目前有:
int hWnd = FindWindow(null, "Window Title Here");
SendMessage(hwnd, 0x201, 0, 0); //Mouse left down
SendMessage(hwnd, 0x202, 0, 0); //Mouse left up
I'm using 我正在使用
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)]
static extern IntPtr SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
and 和
[DllImportAttribute("User32.dll")]
private static extern int FindWindow(String ClassName, String WindowName);
But I get errors, these are: 但我得到错误,这些是:
"The name 'hwnd' does not exist in the current context" “当前上下文中不存在名称'hwnd'”
How can I resolve this? 我该如何解决这个问题?
C# is case-sensitive. C#区分大小写。
hwnd
and hWnd
are different things. hwnd
和hWnd
是不同的东西。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.