Stopping the "Send" "Don't Send" report dialog box....

I have a program that calls an OCX control when the user clicks "Start".  The program seems to run normally but Windows brings up the famous "Send" "Don't Send" dialog box and says that my program has encountered an error and needs to close.  I just want to know if there is some error handling code that I can insert in my project to stop this dialog box from opening.

Who is Participating?
nffvrxqgrcfqvvcConnect With a Mentor Commented:
'You can programatically I mean this isn't very good but It will work.
'I can't right the FindWindow Code for you because I don't have the Error Dialoge to find the window but what you can do is just us SPY and findthe window of the error report dialogue then issure a postmessage API to close the dialog . Basically Add this to a timer.

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Const WM_CLOSE = &H10
Private Sub Form_Load()
    Dim WinWnd As Long, Ret As String, RetVal As Long, lpClassName As String
    Ret = "Untitled - Notepad" ' Something like "Send Error Report"
    WinWnd = FindWindow(vbNullString, Ret)
    lpClassName = Space(256)
    RetVal = GetClassName(WinWnd, lpClassName, 256)
    PostMessage WinWnd, WM_CLOSE, 0&, 0&

End Sub
Are you trying to send mail using MAPI? Is this the dialog you are asking about?
johnqtrAuthor Commented:
No, I'm not trying to send any mail, just curious if I can prevent the famous Windows XP "Send" "Don't Send" error box that comes up when a program has errored.
Never miss a deadline with

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

I just want to state that I beleive when the Error Dialogue appears the caption is the caption of the Program which caused the error so Finding the Window is Better then Using the caption to close it. But That is a example of how it can be done above.
johnqtrAuthor Commented:
Yes, that worked fine.

All Courses

From novice to tech pro — start learning today.