Link to home
Start Free TrialLog in
Avatar of jalymo
jalymo

asked on

Raise alert

How would you raise an alert from a VB program that a Batch file program can obtain?

A batch file executes a VB pgm and depending on user response, the VB pgm needs to tell batch pgm to "go" or "stop". Aside from writing to a msg/flag file, is there some slick way (API, etc.) to raise an alert or set a condition code that the batch file can easily obtain? An example if you've got it.

Thanks
Avatar of hes
hes
Flag of United States of America image

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

Then to pass the value to the batch file in your program use
ExitProcess 1&
In this case it passes a 1
To pass a 100
ExitProcess 100&

Avatar of jalymo
jalymo

ASKER

hes --

Do you know how the batch file program would obtain this exitprocess value?

Thanks,
Let's say you want your program to return 2 values 100 & 50
100 is your go 50 is our quit. In your batch file do the following:
@echo off
start /w yourprogram.exe
if errorlevel 100 goto 100
if errorlevel 50 goto done
:100
your code that you want to execute for the go
goto done
:done
exit
Avatar of jalymo

ASKER

hes --

good!

send the "proposed answer" and I'll dispatch the "accept"
ASKER CERTIFIED SOLUTION
Avatar of hes
hes
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jalymo

ASKER

Thanks!