Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Turning off computer or exiting from program through VB5

Status
Not open for further replies.

alr

Mechanical
Nov 12, 1999
20
I have a computer running Win98 monitoring a testing machine. The readings are via the parallel port using a Pico adaptor and VB5. The 3.3v from the parallel port via a transistor and 2 relays (one is latching), switch the machine motor. The idea is, that on completion of the test or if the power fails and the computer reboots, the program is exited and the test machine motor switched off.

I can't seem to find a method in VB to achieve either exiting the program or switching off the computer.

Tony
 
Replies continue below

Recommended for you

A VB program will end when all it's modules close - normally you just close any external references and set the reference to nothing, then close all the forms. If you really want to force a program to close (and are prepared to accept the memory leaks and data loss consequences) then you can use the End statement

Use the ExitWindowsEx API call to shut the whole machine down. There is an example of use here:

Good Luck
johnwm
________________________________________________________
To get the best from these forums read faq731-376 before posting

Steam Engine enthusiasts:
 
Thank you for that John, as the program saves a data text file every 10 mins, shutting it down or rebooting would not be a problem. I'll write a test program and tryout all your suggestions.

Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor