-->

模拟鼠标点击最小化窗口上(Simulate mouse click on a minimized w

2019-10-31 12:11发布

我目前正在写在C#中,将识别屏幕上的某些图案,并移动到鼠标点击它的应用程序。 目前,该应用程序需要有重点和鼠标光标移动,所以程序运行时计算机无法使用。 我想模拟一个窗口,但实际上没有在屏幕上移动鼠标点击鼠标。 我的目标是要能够模拟鼠标点击即最小化的应用程序。 那会很容易在C#做什么呢?

Answer 1:

你应该阅读有关使用Windows API的.NET(PInvoke的)。 开始这些:

http://msdn.microsoft.com/en-us/library/bb775985(v=vs.85).aspx

http://www.codeguru.com/forum/showthread.php?t=427934



Answer 2:

尝试这个:

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);


文章来源: Simulate mouse click on a minimized window