Programmatically close a message box
I need to be able to automatically click the OK button everytime a certian message box shows up in a given windows application.
I've been reading a few articles about using the Windows API to automatically do stuff like this, but I was wondering what the best way to go about it is. Should I use the mouse_event message to move the mouse over the button and click it? Or should I send tabs and enters via the keyboard to hit the button? Or is there a way to trigger the click event on the button directly?
Also most of the API commands require the hWnd of the given window or control, how can I find that? Will it always be the same for a given button in one application (I would assume not)?
Any input would be most appreciated.
Thanks in advance,