I am trying to click a menu item inside a program called Media Subtitler and all I am trying to do is not working.
At first I tried to use the GetMenu function, but it returned IntPtr.Zero. Then I tried using the ALT + key using the first letter of my menu (F means file), but did nothing. Then I tried using the simple messages MOUSEDOWN and MOUSEUP, but did nothing again (I also tried to create a loop that clicks on everything in this range, but there was no click in this area).
I clearly know that I am working on the right window.
What am I doing wrong?
If someone wants to test it, you can download Media Subtitler for free, and it is not so strong.
Also, here is the code I tested:
Process p = Process.Start(@"C:\Program Files\DivXLand\Media Subtitler\MediaSub.exe"); p.WaitForInputIdle(1500); Thread.Sleep(3000); SetForegroundWindow(p.MainWindowHandle); ShowWindow(p.MainWindowHandle, SW_MAXIMIZE); IntPtr handle = p.MainWindowHandle; SendMessage(handle, WM_NCHITTEST, 0, MakeLParam(18, 29)); //for (int i = 0; i < 200; i++) //{ // for (int x = 0; x < 200; x++) // { // SendMessage(p.MainWindowHandle, WM_LBUTTONDOWN, 0, MakeLParam(i, x)); // SendMessage(p.MainWindowHandle, WM_LBUTTONUP, 0, MakeLParam(i, x)); // } //} //IntPtr menuItems = GetMenu(p.MainWindowHandle); return; //SendMessage(p.MainWindowHandle, WM_COMMAND, 6, 0); SendMessage(p.MainWindowHandle, WM_KEYDOWN, VK_MENU, 0); SendMessage(p.MainWindowHandle, WM_KEYUP, VK_MENU, 0); SendMessage(p.MainWindowHandle, WM_KEYDOWN, VK_F, 0); SendMessage(p.MainWindowHandle, WM_KEYUP, VK_F, 0);
Thanks for any help!