I want yo use SendMessage or PostMessage to press a button in another app
i have a sample code to do this but by getting Window Handle, but don't work
also i used "WinDowse" to get required info. here is the code
private const uint BM_CLICK = 0x00F5;
private const uint WM_LBUTTONDOWN = 0x0201;
private const uint WM_LBUTTONUP = 0x0202;
private void PushOKButton(IntPtr ptrWindow)
{
WindowHandle = FindWindow(null, "Form1");
if (ptrWindow == IntPtr.Zero)
return;
IntPtr ptrOKButton = FindWindowEx(ptrWindow, IntPtr.Zero, "Button", "&Yes");
if (ptrOKButton == IntPtr.Zero)
return;
SendMessage(ptrOKButton, WM_LBUTTONDOWN, 0, 0);
SendMessage(ptrOKButton, WM_LBUTTONUP, 0, 0);
SendMessage(ptrOKButton, BM_CLICK, 0, 0);
}
is There a Compelete Suloution in c# ?