The pop-up box event is a windows error notification with a 'OK' click box. I want to auto-click the 'OK' or suppress the appearance of the pop-up box. But how to capture this event? I can't see anything appearing in event viewer, and i can't track the source of the error (except that originates from excel.exe, which is running a long running process, which occasionally stops unexpectedly when the pop-up box appears).

Other info in the pop-up box includes the following; Microsoft Visual C++ Runtime Error (R6025). On clicking 'OK' the process crashes, which is fine, since at that point i can capture the crash event via windows event viewer, and then run a scheduled task on the back of it (to restart).

The following question is related but different in that i'm simply looking at how to capture and deal with this event, rather than find and fix the cause (link here).

FYI: Running windows server 2012

  • What is the purpose of this? Are you writing an application? If you explain why it may help us to understand the question better :)
    – Dave
    Oct 9 '14 at 7:44
  • @Dave. I have a long running process (essentially calculates some data and writes results to a text file). The pop-up box stops the process running and I have to manually login to rectify it (press 'OK' on the pop-up box, or restart the application). A workable solution would allow me to run a script when the pop-up box appears (that deals with it - eg auto restarts the app), rather than hanging the application until I intervene manually.
    – Yugmorf
    Oct 9 '14 at 8:52
  • What language are you doing this in?
    – Dave
    Oct 9 '14 at 11:21
  • If possible, then .net or vb script. Is it dependant on the language?
    – Yugmorf
    Oct 13 '14 at 4:50

I think you need to use AutoHotKey

It has a timer, meaning you can fire an event every N seconds to check, or, it can detect it natively as well (I think)

SetTimer, MsgBoxCheck, 1000

If WinExist("msgboxTitle", "msgboxTextString", "ahk_class #32770")


; "Waits until the specified window exists."
; secondsToWait can be omitted. (msgboxTitle/TextString are literal strings.)
WinWait, msgboxTitle ahk_class #32770, msgboxTextString, secondsToWait
if ! ErrorLevel ; didn't time out

Source for both code snippets

Also, a post on StackOverflow has a similar question

  • 1
    I'll try that. Thank you. Appreciate your time taken to provide an answer, but unfortunately it seems I can't up-vote you since my reputation is still to low. Thanks all the same.
    – Yugmorf
    Oct 17 '14 at 15:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.