[Request] How send clicks on minimized

10/11/2008 09:04 operaopera#1
How send clicks on minimized in Visual C# ?
10/11/2008 14:26 ChingChong23#2
As far as i know, the handle has to be in focus.
10/11/2008 14:50 Leo_2#3
Quote:
[DllImport("user32.dll")]
public static extern int FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
//FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Notepad", "Untitled - Notepad")) - Provides "window handle"?

private static IntPtr MakeLParam(int LoWord, int HiWord)
{
return (IntPtr)((HiWord << 16) | (LoWord & 0xffff));
}

[DllImport("user32.dll")]
public static extern bool PostMessage(int hWnd, uint Msg, int wParam, IntPtr lparam);
//Example Pending

FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Afx:400000:0:10011:0:0", "[Conquer2.0]"); // Get Conquer's Handle
PostMessage(wind, 0x201, 0, MakeLParam(int.Parse(txtX.Text), int.Parse(txtY.Text))); // LButton Down.
System.Threading.Thread.Sleep(500); // Prevent lag getting the clicks in the wrong order.
PostMessage(wind, 0x202, 0, MakeLParam(int.Parse(txtX.Text), int.Parse(txtY.Text))); // LButton Up.
Try messing with that code, should produce a mouse click at txtX / txtY's text box value.