+ Reply to Thread
Results 1 to 6 of 6

Disable Windows Debgug/ Close Program pop-up

Hybrid View

  1. #1
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Disable Windows Debgug/ Close Program pop-up

    Hi,

    I am automating a program by calling Windows API functions and subs. From time to time, the program that is being automated crashes and the '... has stopped working' dialog box appears with two options:

    a) Check online for a solution and close the program
    b) Close the program

    I already have another way to monitor the program to make sure that it is not hanged, but this dialog box that handles unhandled executions is a nuisance. I found a way to disable this (http://msdn.microsoft.com/en-us/library/bb513638.aspx)

    I think the code would probably use SetUnhandledExceptionFilter and UnhandledExceptionFilter but not sure how to implement it any further. Any thoughts?

    Declare PtrSafe Function UnhandledExceptionFilter Lib "kernel32" Alias "UnhandledExceptionFilter" (ExceptionInfo As EXCEPTION_POINTERS) As Long
    Declare PtrSafe Function SetUnhandledExceptionFilter Lib "kernel32" Alias "SetUnhandledExceptionFilter" (ByVal lpTopLevelExceptionFilter As LongPtr) As LongPtr
    Thanks.

    abousetta
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Disable Windows Debgug/ Close Program pop-up

    Hello Ahmed,

    The error you are receiving could be a COM error. Have you identified what causes the error? Do you know the error number?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Disable Windows Debgug/ Close Program pop-up

    Hi Leith,

    Just to clarify, I'm only using Excel to execute API commands to send key strokes to the EndNote program. During the looping, I am receive different error messages based on the OS that the program is running on and particular file that is being updated. One of the computers shows this information:

      Problem Event Name:	APPCRASH
      Application Name:	EndNote.EXE
      Fault Module Name:	EndNote.EXE
      Exception Code:	c0000005
      Exception Offset:	00189d92
      OS Version:	6.1.7601.2.1.0.256.4
    At other times/ other OS, I receive a Msgbox stating that the program is terminating in an abnormal manner and it has C++ in the window caption. Another time (but I could not replicate it right now to get the error message), there was a generic error that when I looked it up said that the causes could be anything from a corrupt dll to memory issues to hardware problems.

    In all cases, I don't particularly care about the error message, all I want to do is close the program without displaying the message box. I already have a second application that is monitoring the EndNote program and restarting it if it hangs. The dialog boxes though remain and so I have to manually remove them. I'm trying to circumvent this by not showing them in the first place.

    Any thoughts?

    abousetta

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Disable Windows Debgug/ Close Program pop-up

    Hello ahmed,

    The dialogs are being generated most likely by ENDNOTE itself. It is possible to write an API routine to look for dialog boxes. Answering them automatically can be difficult. Non system dialogs may not conform to Microsoft standards making the process of clicking the proper button difficult. I will have to review my library for dialog API routines. I remember delving into this a few years ago out of curiosity or perhaps insanity, not sure which was the motivator.

  5. #5
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Disable Windows Debgug/ Close Program pop-up

    Hi Leith,

    Yes, I agree that the errors seem to generated by EndNote (or at least as a result of EndNote crashing). I just want to Windows to stop the program instead of asking me what to do. I did find this for turning error reporting off, but I would like it to be turned off again (toggle):

    [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
    I've tried going through the routine of clicking on the 'Close Program' button, but each Windows OS seems to have a different set of options and I just need it to not to appear to begin with.

    Thanks.

    abousetta

  6. #6
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Disable Windows Debgug/ Close Program pop-up

    Hi,

    I've also found this on the MSDN website to allow programs to be selectively added or removed from the Excluded Applications List:

    HRESULT WINAPI WerAddExcludedApplication(PCWSTR 
      _In_  BOOL bAllUsers
    );
    
    
    HRESULT WINAPI WerRemoveExcludedApplication(
      _In_  PCWSTR pwzExeName,
      _In_  BOOL bAllUsers
    );
    I'm still trying to find how to call these from vba instead of C++.

    abousetta

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Enable / Disable Macros behaving differently in Excel 2003 from Windows XP to Windows 7
    By TC1980 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-21-2013, 09:09 AM
  2. Program wont run in windows 7
    By gjjh25 in forum Microsoft Windows Help
    Replies: 5
    Last Post: 02-28-2013, 07:16 AM
  3. Disable close workbook but still force users to close thru command button
    By rathig in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-18-2013, 07:29 AM
  4. multiple program windows?
    By tafsteward in forum Excel General
    Replies: 2
    Last Post: 08-08-2005, 12:05 AM
  5. [SOLVED] Program Windows
    By gmsmithwick in forum Excel General
    Replies: 1
    Last Post: 02-07-2005, 11:24 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1