10/11/2008, 14:50
|
#3
|
elite*gold: 0
Join Date: Apr 2006
Posts: 23
Received Thanks: 4
|
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.
|
|
|