Jump to content

Vista program crash


Recommended Posts

I have applications that crash under Vista with the error message "APPNAME has stopped working". Because the systems are left unattended, I need an AutoIt script that automatically presses the "Close Program" button that is shown in the error dialog.

I tried using WinWaitActive for this, but it doesn't work. Furthermore, when I use Au3Info it is frozen while the error message is displayed, so I can't find out any other information about the dialog box.

The script I use works in XP, just not Vista (with the window titles changed, of course).

Can anyone help?

Link to comment
Share on other sites

I don't know if hitting enter will get rid of it so yeah.

$i = 0 ;Count how many times i saved your life

While 1
   While (WinExists("Title","Text")) ;make sure we get rid of it
      WinActivate("Title","Text") ;activate it
     WinActive("Title","Text") ;Check if activate it
      Send("{ENTER} ") ;send enter to close it
      WinClose("Title","Text") ;make sure it closes :)
      If Not (WinExists("Title")) Then ;make sure it went away before we increase saved life count
         $i = $i + 1 ;increase saved life count
      EndIf
   WEnd
   
   If Not (ProcessExists("Your Program")) Then ;make sure your program is still running
      ExitLoop ;if not then lets end this script
   EndIf
   
   Sleep(100)
WEnd

MsgBox(4096, "Stats", "I saved your life " & $i & " many times!")
Link to comment
Share on other sites

  • Moderators

Slabdog,

A bit of searching (good tip ;-) ) found this little function which might help:

; finding if an application is hung
; neogia

If _NotResponding("TITLE HERE", "TEXT HERE[OPTIONAL]", 1) Then  ; The last parameter indicates whether you want to close the hung app or not.
    MsgBox(0,"", "Hung Application, closing app now.")
Else
    MsgBox(0,"", "Application running as intended.")
EndIf

Func _NotResponding($title, $text, $closeIfHung = 0)
    $hWnd = WinGetHandle($title, $text)
    If $hWnd == "" Then
        MsgBox(0,"Error","Could not find window")
        Exit
    EndIf
    $retArr = DllCall("user32.dll", "int", "IsHungAppWindow", "hwnd", $hWnd)
    If @error == 0 Then
        If $retArr[0] == 1 Then
            If $closeIfHung Then
                ProcessClose(WinGetProcess($title, $text))
            EndIf
            Return 1
        EndIf
    Else
        Return 0
    EndIf
EndFunc

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Slabdog,

A bit of searching (good tip ;-) ) found this little function which might help:

; finding if an application is hung
; neogia

If _NotResponding("TITLE HERE", "TEXT HERE[OPTIONAL]", 1) Then ; The last parameter indicates whether you want to close the hung app or not.
    MsgBox(0,"", "Hung Application, closing app now.")
Else
    MsgBox(0,"", "Application running as intended.")
EndIf

Func _NotResponding($title, $text, $closeIfHung = 0)
    $hWnd = WinGetHandle($title, $text)
    If $hWnd == "" Then
        MsgBox(0,"Error","Could not find window")
        Exit
    EndIf
    $retArr = DllCall("user32.dll", "int", "IsHungAppWindow", "hwnd", $hWnd)
    If @error == 0 Then
        If $retArr[0] == 1 Then
            If $closeIfHung Then
                ProcessClose(WinGetProcess($title, $text))
            EndIf
            Return 1
        EndIf
    Else
        Return 0
    EndIf
EndFunc

M23

This would work better since mine just kills the error window.
Link to comment
Share on other sites

A bit of searching (good tip ;-) ) found this little function which might help:

; finding if an application is hung
Melba23,

A bit of testing (good tip ;-) ) found that your solution didn't work.

Please enlighten me as to what search terms you used to find that snippet, because I searched and came up with nada. Your GoogleFu is obviously superior to mine (although searching for "Vista" and "crash" gave plenty of hits).

I eventually got round the problem by setting the following registry keys:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting]

"ForceQueue"=dword:00000001

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\Consent]

"DefaultConsent"=dword:00000001

which stopped the box from being shown in the first place. It's not an AutoIt solution, but it does the job I needed it to do.

Thanks to you and Godly for trying to help, anyway. I appreciate it.

Link to comment
Share on other sites

  • Moderators

Slabdog,

I do not have a program that regularly crashes so I have never been able to prove that neogia's function actually worked! Sorry it did not work for you - however, it seems to be generally accepted that it does (for example see here and here).

As to searching - I use a "param +param +param etc" searches all the time. That seems to give the best results - although it still needs a good rummage through the returned threads. :-) In this case I looked for "detect +not +responding" and found it at #11.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

M23,

Ah, I was searching for Vista and "Stopped working" and combinations of that. I didn't think of "Not responding" because that isn't in the error box I was trying to clear.

But at least people searching for this issue in future will find this thread. ^_^

Thanks again!

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...