×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Turning off computer or exiting from program through VB5

Turning off computer or exiting from program through VB5

Turning off computer or exiting from program through VB5

(OP)
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

RE: Turning off computer or exiting from program through VB5

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:
http://www.mentalis.org/apilist/ExitWindowsEx.shtml

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

Steam Engine enthusiasts: www.essexsteam.co.uk

RE: Turning off computer or exiting from program through VB5

(OP)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login



News


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close