1

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

Yugmorf
  • 135

1 Answers1

0

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)

#Persistent
SetTimer, MsgBoxCheck, 1000

MsgBoxCheck:
If WinExist("msgboxTitle", "msgboxTextString", "ahk_class #32770")
{
   WinClose
   ExitApp
}

OR

; "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
    WinClose
ExitApp

Source for both code snippets

Also, a post on StackOverflow has a similar question

Dave
  • 25,513