Restore window handle and press button

I'm sure this is possible somehow, but not sure if there are too many hoops to jump to make it worthwhile, hoping that someone can point me in the right direction. I have a problem (related to the installer) in which I have a pop-up dialog box pretty regularly that I need to click cancel.

What I would like to do is close it programmatically / possibly through a service so that it does not bother me (provided that I cannot fix the root problem). So, I am wondering if there is a way to capture the window handle in any way (check it, perhaps by comparing the text on the label), then find the control in the window (cancel button) and send the event to it?

If anyone knows how I could achieve this or a few starters that would be good.

+1
source share
2 answers

Two ways to do this:

  • To get the handle when you talk about the window, use the FindWindow API, then you have to list the controls associated with this handle and send the message WM_BUTTONDOWN, WM_BUTTONUP together to simulate a mouse click using SendMessage .
  • But there is a simpler method, suppose the cancel button is called btnCancel, then that would be enough btnCancel.Click().

, , , . , , ... ...

: , , "" -...

, , , .

0

AutoIt3. , , , WindowsAPI, . API- PInvoke #, . AutoIt script, .

+1

All Articles