You can do it, but it's dangerous if not done right.

Make this declaration:

Private Declare Sub ExitProcess Lib "kernel32" (ByVal uExitCode As Long)

Then, when you want to exit and return an errorlevel, do the following:

ExitProcess 3


This will kill your VB program instantly and return the errorlevel 3 - but 
you MUST make sure that you have first manually unloaded all forms, 
objects, closed all files, databases, released memory and resources etc., 
as the "cleanup" routines normally run by the VB runtime when the program 
exits are not called. If you leave something loaded, you will end up with a 
memory leak at best.


At 10:04 AM 6/7/2002, Tom Schwarz wrote:

>Visual Basic 6.0 question....  (yes, it does relate)
>
>I am trying to code a simple "external" program that will be called by
>declude but I cannot figure out how to return a value to Declude when done.
>Scott told me how to do it in "C" but I cannot find it in VB.
>
>Anybody know how to return a value to the calling program in Visual Basic?
>
>
>---
>[This E-mail was scanned for viruses by Declude Virus 
>(http://www.declude.com)]
>
>---
>
>This E-mail came from the Declude.JunkMail mailing list.  To
>unsubscribe, just send an E-mail to [EMAIL PROTECTED], and
>type "unsubscribe Declude.JunkMail".  You can E-mail
>[EMAIL PROTECTED] for assistance.  You can visit our web
>site at http://www.declude.com .

_______________________
Scott MacLean
[EMAIL PROTECTED]
ICQ: 9184011
http://www.nerosoft.com

---
[This E-mail was scanned for viruses by Declude Virus (http://www.declude.com)]

---

This E-mail came from the Declude.JunkMail mailing list.  To
unsubscribe, just send an E-mail to [EMAIL PROTECTED], and
type "unsubscribe Declude.JunkMail".  You can E-mail
[EMAIL PROTECTED] for assistance.  You can visit our web
site at http://www.declude.com .

Reply via email to