我目前正在用 C# 编写一个应用程序,它将识别屏幕上的某些模式并移动到鼠标单击它。目前,应用程序需要获得焦点和鼠标光标移动,因此在程序运行时计算机无法使用。我想模拟鼠标在窗口上的点击,但实际上并没有在屏幕上移动鼠标。我的目标是能够模拟鼠标点击最小化的应用程序。在 C# 中容易实现吗?
3114 次
2 回答
1
您应该阅读有关使用 .NET (PInvoke) 中的 Windows API 的信息。从这些开始:
http://msdn.microsoft.com/en-us/library/bb775985(v=vs.85).aspx
于 2011-08-11T16:32:07.563 回答
0
尝试这个:
public const int SW_MAXIMIZE = 3;
private delegate bool EnumDesktopWindowsDelegate(IntPtr hWnd, int lParam);
[DllImport("user32.dll")]
static extern bool EnumDesktopWindows(IntPtr hDesktop, EnumDesktopWindowsDelegate lpfn, IntPtr lParam);
[DllImport("user32.dll", EntryPoint="FindWindow", SetLastError = true)]
public static extern IntPtr FindWindowByCaption(IntPtr ZeroOnly, string lpWindowName);
[DllImport("USER32.DLL")]
public static extern bool ShowWindow(IntPtr hWnd,int nCmdShow);
于 2011-08-11T16:43:08.830 回答