I have some VB code which makes use of a COM api and results in a certain dialog box popping up on the screen. My program is a console application, that needs to run in a batch file, but I haven't found any other way to do things other than finding a way to automatically manipulate the dialog box.
Here is the api call (omitting setup code) that results in the dialog popping up:
Dim oScript = New ProvideX.Script()
' Setup code here '
oScript.Run(commName)
This method has no return value, and no extra parameters that would enable me to fill in the values I need through the API.
I have found one method to get the handle of the dialog window, but I'm not sure if it will work, or if it will grab onto the Command line window instead.
Dim windowHandle = Process.GetCurrentProcess().MainWindowHandle
Is there any way to get a list of windows that were created by my process so I can identify the one that corresponds to my dialog?
Also, can anyone point me in the right direction of how to do send mouse clicks and keyboard presses to an unmanaged dialog box, or is there some better way to do what I need.
This is a fairly simple dialog box that has a warning prompt that needs to be accepted by clicking on an ok button. Then there are two text boxes that need to be filled out with data I have. And then I need to click on another button.
I'm not asking for a complete answer, I'm just looking for the general jist of how to do it.
Edit: I was doing research at PINVOKE.net and I think SendInput will work if I can get the right handle. I've walked through the dialog and it can all be handled by keyboard input.