Click to See Complete Forum and Search --> : Shutdown and Restart API's for VB6


LabRat
July 12th, 2001, 09:37 AM
I got to playing with some new shells and like the speed that can be gained without the fluff.
Could someone here tell me how to access the shutdown and restart commands from the program under design? It'll save a lot on the having to ctrl+alt+del just to shutdown. Thanks for any suggestions.

opiate
July 14th, 2001, 03:04 PM
Hey Shift...

Here is what you would use for VB.

Declaration:

Private Declare Function ExitWindowsEx Lib "user32" _
(ByVal uFlags As Long, ByVal dwReserved As Long) As Long


Then just call the function from a click event or whatever.

Dim rc As Long

rs=ExitWIndows(PARAMETER)

you can use any parameter from the list

EWX_LOGOFF
EWX_SHUTDOWN
EWX_REBOOT
EWX_FORCE
EWX_POWEROFF
EWX_FORCEIFHUNG

so you would use

Dim rc As Long

rc=ExitWindowsEx(EWX_SHUTDOWN)


...hope that helps, you can build a class file for the different params. I have built a class file and dll that you can call from your app. lemme know...............eeeshh if I can find it.

l8r, opiate

LabRat
July 16th, 2001, 11:09 AM
Thanks Opiate,

I'll try it this week. Building classes is a little out of my league right now, but I'm getting there.

See you around,
LabRat