0

For the purposes of my course work, I need to implement an auto-confirmation of the file selection by means of WinApi. There is a browser Chrome, in which some actions take place. And when the dialog window opens for uploading a file, it is necessary to make an automatic selection of the file from the specified path. How can this be done by means of WinAPI? P.S. the application is waiting for the dialog window to start, I have managed to implement this. I found child windows via Window SPY, but when I try to send a message to them by descriptor nothing happens (I tried the class name "Search Box" and the child ones). SendMessage(searchBox,WM_SETTEXT,0,"text");//Not work

  • 2
    Difficult to understand, what problem you are trying to solve, but the solution is likely a combination of [WinEvents](https://learn.microsoft.com/en-us/windows/win32/winauto/what-are-winevents) and [UI Automation](https://learn.microsoft.com/en-us/windows/win32/winauto/entry-uiauto-win32). – IInspectable Jun 01 '22 at 20:07
  • I can't send the SETTEXT message to the dialog window controllers, they just ignore it. Although I have the descriptors – LEGENDA warc Jun 01 '22 at 21:25
  • If you type something in the box and do a read with [WM_GETTEXT](https://stackoverflow.com/a/7740920/5623232), does it work? If not, then you likely have the wrong handle. – NPras Jun 02 '22 at 00:44
  • I check is spy++```var dialogWindow = FindWindow("#32770", "Open"); var workerWindow = FindWindowEx(DialogHandle, IntPtr.Zero, "WorkerW", null); //... var searchBox = FindWindowEx(universalSearchBand, IntPtr.Zero, "UniversalSearchBand", null); //... var editBox = FindWindowEx(searchBoxO, IntPtr.Zero, "SearchEditBoxWrapperClass", null); var direct = FindWindowEx(editBox, IntPtr.Zero, "DirectUIHWND", null); SendMessage(workerWindow, WM_SETTEXT, 0, "test"); //... SendMessage(direct, WM_SETTEXT, 0, "test"); ``` but settext not working... – LEGENDA warc Jun 02 '22 at 06:08

0 Answers0