Is there a way to programmatically detect whether a MsgBox is displayed to the user in a Desktop application?
Reason for asking: I have an old program (mainly Linux) with lots of potential MsgBox:es. I monitor the program remotely and cannot see the screen, except for taking screenshots.
The answer is no. But you could easily create your own alert dialog to replace it, which could behave however you wish (for example, by sending you an email whenever it is displayed).
Thanks guys,
No, it is an existing, rather large Desktop app, which could not be a Console / command line application.
And right now I am just considering making minor changes, just to indicate if any MsgBox is present on screen.
So replacing all MsgBoxes with additional features is not for now.
As I understand, it is not possibe.
Thanks again.
Why don’t you create a global method MyMsgBox that accepts the same parameters as MsgBox and writes out something to a file when the message box appears and then deletes the file afterwards. You can then do a find & replace in your code switching MsgBox to MyMsgBox.
As has been noted by everybody here, replacing MsgBox is probably the easiest code change you’ll ever make. If the functionality you’re looking for is important to you, I really suggest you explore the various suggestions given so far; it’s very feasible.
This needs to be a boolean var, that is set to true before the MessageDialog.Show command is executed (probably written to a file as well, if you can’t see the screen), and set to false thereafter.
In this case, it would be better to set to false within the MessageDialog.close event (not available directly, but with a custom-made MessageDialog window, this variable can be set on its close event. )
Just as suggested I went for substituting all “MsgBox” with a global method “MyMsgBox”.
MyMsgBox(s as String)
msgboxshowing=True
MsgBox s
msgboxshowing=False
In my case there is no need for writing to a file. (The global Boolean msgboxshowing will be included among
a bunch of other data being sent repeatidly to another location and shall only serve as an alert.)