'console Module Module1 Public Function Main() As Integer Dim RetValue As Integer = 1 Return RetValue End Function End Module
'form/console Dim ExCode As Integer = 1 'a Environment.ExitCode = ExCode End 'b Environment.Exit(ExCode)
Private Declare Sub ExitProcess Lib "kernel32" (ByVal uExitCode As Long) Private Sub Form_Unload(Cancel as Integer) ExitProcess 1 End Sub 'NOTE: the VB6 IDE will also be terminated
DECLARE SUB ExitLevel ALIAS "_EXIT" (BYVAL n AS INTEGER) ErrorLevel% = 1 ExitLevel ErrorLevel% 'NOTE: the QuickBasic IDE will also be terminated
INT 21 - DOS 2+ - "EXIT" - TERMINATE WITH RETURN CODE AH = 4Ch AL = return code Notes: unless the process is its own parent, all open files are closed and all memory belonging to the process is freed all network file locks should be removed before calling this function