Hi, I want to wait for and close a modal form (a popup) from another application, as soon as it appears. I want to do this from VB.NET, but suggestions in C# should be easily translateable.
I can hard-code the modal popup's caption in my app, since it's long and unique. What I want to do is simulate either the user clicking on the close ("X") button on the form, or a click on the defeault, tab-order 0 button of the form. Either would work.
Maybe I need more info about the modal popup other than the title bar's caption? In any case, it's safe to use it as an unique identifier of that modal form. I also want that code to terminate checking as soon as the first event of closing the popup happens.
I believe it's trivial, but I can't find any ready info on that. Microsoft says I should not send WM_CLOSE
to the modal popup, since it will call DestroyWindow() instead of EndDialog(), but to be honest I don't even know what "sending WM_CLOSE
" to the "window" means =/
Thanks for sharing a bit of guru-ness! :D
P.S.: This may be trivial in AutoHotkey. I feel lame not knowing it, I know I need it.