|
|
|
If your VB application is meant to be called from within a Ms-Dos batch file, you must be able to return Dos an error code. This can be accomplished using the ExitProcess API function: |
Note that the ExitProcess API function is similar to the END command, in that it prevents all the usual clean up code from executing. Therefore, you must call it only after you've manually closed all forms, files and databases, released all memory and resources allocated through Windows, etc. The following Ms-Dos batch program demonstrates how you can test the ErrorLevel returned by the VB application |
Click here to copy the following block | START /W project1 REM ErrorLevel codes must be tested in reverse order IF ERRORLEVEL 5 GOTO Err5 IF ERRORLEVEL 4 GOTO Err4 IF ERRORLEVEL 3 GOTO Err3 IF ERRORLEVEL 2 GOTO Err2 IF ERRORLEVEL 1 GOTO Err1
ECHO ErrorLevel = 0 GOTO Exit :Err1 ECHO ErrorLevel = 1 GOTO Exit :Err2 ECHO ErrorLevel = 2 GOTO Exit :Err3 ECHO ErrorLevel = 3 GOTO Exit :Err4 ECHO ErrorLevel = 4 GOTO Exit :Err5 ECHO ErrorLevel = 5
:Exit REM End of batch file |
Note that you must use the syntax START /W if you're running under Windows 95.
|
|
|
|
Submitted By :
Nayan Patel
(Member Since : 5/26/2004 12:23:06 PM)
|
|
|
Job Description :
He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting. |
View all (893) submissions by this author
(Birth Date : 7/14/1981 ) |
|
|