From: Fernando Rodriguez on

I'm trying to instercept all errors in my app with SetUnhandledExceptionFilter(),
but whenever an exception is raised, my excpetion handler function gets called
over and over.

I reduced my exception handler to a do nothing, but the error still persists:

------------------------------------------------------------------------------------
Public Function ExceptionHandler(ByRef ExceptionPtrs As EXCEPTION_POINTERS)
As Long
On Error Resume Next
Dim Rec As EXCEPTION_RECORD, strException As String, AutoRestart As Boolean
Rec = ExceptionPtrs.pExceptionRecord
Do Until Rec.pExceptionRecord = 0
CopyMemory Rec, Rec.pExceptionRecord, Len(Rec)
Loop

ExceptionHandler = -1

End Function
------------------------------------------------------------------------------------

Whenever an exception is raised, for example:


-----------------------------------------------------------------------
Private Sub cmdCommand1_Click()

CopyMemory ByVal 0&, 1&, 1

End Sub
-----------------------------------------------------------------------

the exception handler is called over and overin an endless loop.

what am I doing wrong?

PS. This is how I'm calling SetUnhandledExceptionFilter():

-------------------------------------------------------
Public Sub InstallExceptionHandler()
On Error Resume Next
If Not blnIsHandlerInstalled Then
Call SetUnhandledExceptionFilter(AddressOf ExceptionHandler)
blnIsHandlerInstalled = True
End If
End Sub
-------------------------------------------------------