VB中怎么设置ErrorLevel
来源:百度知道 编辑:UC知道 时间:2024/07/02 18:44:07
模块中声明:
Public Declare Sub ExitProcess Lib "kernel32" (ByVal uExitCode As Long)
Public Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long
窗体代码:
Private Sub Command1_Click()
' TerminateProcess -1, 1125 'also can
ExitProcess 1234
End Sub
测试程序:
模块声明:
Public Declare Function GetExitCodeProcess Lib "kernel32" (ByVal hProcess As Long, uExitCode As Long) As Long
Public Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Public Declare Function CloseHandle Lib