Jump to content

Detect and kill "...has encountered a problem..." dialog


pnp
 Share

Recommended Posts

Using AutoIT scripts to test a GUI, we sometimes encounter a problem with the text "guiname" has encountered a problem, please tell microsoft....send/don't send.

Is there a way to detect this dialog an kill it by sending ("{!d}")? I have tried using WinActive("dialog name", "has encountered a problem"), but it does not seem to locate the open dialog.

Regards,

Kasper Andersen

Link to comment
Share on other sites

Welcome,

You can use Adlib to look for the window. BadApp tested this ok for me.

AdlibEnable('_Adlib')

; checking for unexpected window here

AdlibDisable()

Exit

Func _Adlib()
    Local $title = 'BadApp.exe'
    If WinExists($title) Then
        ControlClick($title, 'De&bug', 'Button1')
    EndIf
EndFunc

;)

Edited by MHz
Link to comment
Share on other sites

Welcome,

You can use Adlib to look for the window. BadApp tested this ok for me.

AdlibEnable('_Adlib')

; checking for unexpected window here

AdlibDisable()

Exit

Func _Adlib()
    Local $title = 'BadApp.exe'
    If WinExists($title) Then
        ControlClick($title, 'De&bug', 'Button1')
    EndIf
EndFunc

;)

Thanks for the quick reply. Would this also work when Windows has a habbit of naming the error window the same as the main app.

Thanks.

Link to comment
Share on other sites

Now after having tried several things, I am still left at where I once began :-)

The status of both dialogs, which ARE named the same, is "Not Running" in the task manager and even if I try to activate window it still does not work correctly, with either adlib, winactive or winexists. Detecting on the window title just applies the kill to the main window at an early stage.

I tried to use the "open window info" tool inside the AutoIT, but as the microsoft error dialog has topmost priority on its thread, the info tool won't work at all, as long as the error shows.

I still am hoping that someone has tried this on a windows xp or newer OS. I guess that there would be no problem in Windows 2000, as it does not have the report error function from Microsoft.

Thanks.

Link to comment
Share on other sites

Now after having tried several things, I am still left at where I once began :-)

I do not understand your results.

Try this with the BadApp I linked above

$pid = Run('"' & @ScriptDir & '\BadApp.exe"')
AdlibEnable('_Adlib')
WinWait('Bad Application')
ControlClick('Bad Application', '', 'Button12')
ProcessWaitClose($pid)
AdlibDisable()

Exit

Func _Adlib()
    $title = 'BadApp.exe'
    If WinExists($title) Then
        ControlClick($title, 'De&bug', 'Button1')
    EndIf
EndFunc

It closes the microsoft error window for me just fine.

Link to comment
Share on other sites

I do not understand your results.

Try this with the BadApp I linked above

$pid = Run('"' & @ScriptDir & '\BadApp.exe"')
AdlibEnable('_Adlib')
WinWait('Bad Application')
ControlClick('Bad Application', '', 'Button12')
ProcessWaitClose($pid)
AdlibDisable()

Exit

Func _Adlib()
    $title = 'BadApp.exe'
    If WinExists($title) Then
        ControlClick($title, 'De&bug', 'Button1')
    EndIf
EndFunc

It closes the microsoft error window for me just fine.

I sorted the thing out last night. When the Microsoft error reporting service window shows, a process named dwwin.exe is run. By looking for it using ProcessExists and closing it using ProcessClose i managed to deal with the error quite nicely.

Thanks anyway.

Regards,

Kasper Andersen

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...