好吧,codeSMART 有一个选项在您的应用程序上安装全局句柄,第一次调用 SetUnhandledExceptionFilter (win api) 应该在加载模块主窗体或关闭程序时安装,因此调用 SetUnhandledExceptionFilter。
代码有点长,所以复制方法名称和 api 调用
Public Sub InstallGlobalHandler()
On Error Resume Next
If Not lnFilterInstalled Then
Call SetUnhandledExceptionFilter(AddressOf GlobalExceptionHandler)
lnFilterInstalled = True
End If
End Sub
Public Sub UninstallGlobalExceptionHandler()
On Error Resume Next
If lnFilterInstalled Then
Call SetUnhandledExceptionFilter(0&)
lnFilterInstalled = False
End If
End Sub
Run Code Online (Sandbox Code Playgroud)
这里还有模块的 Record Structure y api 声明
- CopyMemory
- SetUnhandledExceptionFilter
- RaiseException
' Public enums
-EExceptionType
-EExceptionHandlerReturn
-Private Const EXCEPTION_MAXIMUM_PARAMETERS = 15
' Private record structure
-Private Type CONTEXT
'Structure that describes an exception.
-Private Type EXCEPTION_RECORD
'Structure that contains exception information that can be used by a debugger.
-Private Type EXCEPTION_DEBUG_INFO
-Private Type EXCEPTION_POINTERS
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
500 次 |
最近记录: |