I assume the message boxes are being generated by a separate app that you
have no ability to modify?
You can do this using the Windows API. You can iterate through all the
windows with EnumWindows and EnumChildWindows and get the window text with
GetWindowText. Or you can search for the window directly with FindWindow and
FindWindowEx.
Once you have the handle to the window you can send a message to it via
SendMessage. If it's a standard dialog box, you can probably just send it
WM_KEYDOWN with a parameter of VK_ENTER.
You can find documentation on these APIs in C# on Pinvoke.net. You can also
google the functions I mentioned to find code samples.
As for getting a notification of a new message box, you could probably
create a windows event hook to do it. You can Google windows hooks to find
out more. That's probably overkill, though. I'd probably just use a timer to
have my app check for a new dialog box every 10 seconds or so.
Andrew Faust
"Martin Arvidsson, Visual Systems AB" <ma**************@vsab.netwrote in
message news:uR**************@TK2MSFTNGP03.phx.gbl...
Hi!
I am constructing a program that will massverify some reports.
How ever there is a message dialog comming up saying that the report is up
to date or needs change.
Is there a way to detect when this dialog appears and send a key stroke or
send a message to the button on the dialog?
I know the title of the message dialog.
Regards
Martin