I want to click a button from a wpf window from another wpf window ... But I have an issue , the click fires correctly but nothing happens!
here's my code :
int click_x = 60;
int click_y = 30;
int click_point_x = Convert.ToInt32(working_area.Margin.Left) + click_x;
int click_point_y = Convert.ToInt32(working_area.Margin.Top) + click_y;
IntPtr windowHandle = new System.Windows.Interop.WindowInteropHelper(this).Handle;
var w = (click_point_y << 16) | click_point_x;
if (windowHandle != IntPtr.Zero)
{
HandleRef hWnd = new HandleRef(windowHandle, windowHandle);
PostMessage(hWnd, 0x201, 0x00000001, w);
await Task.Delay(500);
PostMessage(hWnd, 0x202, 0x00000001, w);
}
I added task.delay and tested this , after I calling postmessage on left mouse down , If I click at delay time , it works! but if I don't , nothing happens , only color of button changes like it's clicked but nothing happens!
How can I make it working ?
I think there's some issue with click function.
This is what happens : http://murder.is-best.net/what_happens.mp4
User contributions licensed under CC BY-SA 3.0