Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Callling shutdown
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00086398
Message ID:
00086587
Views:
29
>Look in the Win32API.hlp file (Fox 2.6 & 3.0). There is a function in there to shut down the PC. The function is ExitWindows or ExitWindowsEx. I have used this but failed to get it working properly. Apparently due to permissions. If you get it working, I would like to see the command combination you use.

Assuming Win95 with APM enabled, the following will work:

DECLARE SHORT ExitWindowsEx IN Win32API ;
INTEGER nShutDownMode, ;
INTEGER nReserved

DECLARE INTEGER ExitProcess IN Win32API ;
INTEGER ExitCode

#DEFINE LoginNewUserFlagValue 0
* This will start the new user login w/o complete shutdown, and under some circumstances
* leaves the app running when the new user logs in if you don't take care to die quickly

#DEFINE ShutdownFlagValue 1
* This will force a complete shutdown, with APM, power off

#DEFINE RestartFlagValue 2 && This will restart Windows
* This shuts down Windows and warm-boots

* Pick your poison, and execute:

ON SHUTDOWN ExitProcess(0)

nMyReturnValue=ExitWindowsEx(nChosenSutdownMode,0)

Ed

CLOSE ALL
FLUSH
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform