Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
More shutdown
Message
From
26/03/1998 22:11:11
 
 
To
26/03/1998 03:12:30
Emmanuel Huybrechts
Technimeca International Corp.
Montréal, Quebec, Canada
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00087155
Message ID:
00087542
Views:
36
I probably wasn't clear in my code - I was doing things from the top of my head at the time. To clarify: DECLARE INTEGER ExitProcess IN Win32API ; INTEGER nExitCode There is no space in "ExitProcess". nExitCode is an integer value (actually a long) that is returned to the Windows environment by the terminated process (in our case, VFP) and can be examined programmatically through the Win32API. I use values other than 0 frequently to communicate return results to things like InstallShield rather than loading up registry keys or a batch file to pass a single result code. I've found that it cleans up VFP better than QUIT or CANCEL in many cases where odd DLL Declarations haven't been cleaned up at exit, and it shuts down all threads spawned by VFP. ON SHUTDOWN ExitProcess(0) should have read ON SHUTDOWN =ExitProcess(0) I've been spoiled by my wrapper class; I normally have a call to the ExitVFP() method of my API class there, which does a little cleanup before issuing the API call, and I forgot to prefix the DLL call with an '='. It's silly to actually perform an assign with the result, since firing it is an absolute kill on VFP. nMyReturnValue=ExitWindowsEx(nChosenShutdownMode,0) nChosenShutdownMode should be assigned to one of the #DEFINEd values given in the example. To force a full shutdown, nChosenShutdownMode should be assigned a value of 1; if APM is enabled on a Win95, Win98 or NT 5.0 beta machine, your system will actually power down. A value of 0 starts the Login New User Dialog and should trigger a call to the ON SHUTDOWN code in your app (in my case, a call to ExitProcess()), and with no ON SHUTDOWN active, has a nasty tendency under Win95 to leave the app running if the same userid is logged in again. A value of 2 causes a Windows shutdown followed by a warm boot, that will eventually restart Windows for you. I use this a good deal in conjunction with a registry RunOnce key value to shut down an app and restart Windows when controlling installation processes - do what can be done prior to rebooting in one app, have a second app that picks up from there, write the path for the second app in the RunOnce key to start the next phase of the install after reboot, and do an =ExitWindowsEx(2,0). Works like a charm except in some really obnoxious dual-boot configurations that default to starting the wrong version of Windows after a warm boot. Hope this helps a bit, Ed > >>Dear Nigel, >>Thank you for your help. Due to my inabilty to follow >>instructions despite the completeness of Mr.Rauh's >>directions I have had the following problems iln >>implimenting them. I'm sure you were more >>sucessful as I simply do not have the requisite >>experience with API and made some stupid error. >>1) On the Declare Integer ExitProcess IN Win32API; >> Integer Exitcode I get an error "Cannot find entry >> point Process in the dll. >>2) ON SHUTDOWN Exit Process(0) >> I get "unrecognized command verb". > >I think it is not "Exit Process" but "ExitProcess" without blank. That's why you get "Cannot find entry point Process in the dll" > >>3) nMyReturnValue=ExitWindowsEx(nChosenShutdownMode,(0) >> Returns "variable'NCHOSENSHUTDOWNMODE' is not found" >> >>I am hoping you will shed some light on what I am doing >>wrong. Thanks Derek Linebarger. > Attachment Converted: Edward M Rauh.vcf
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
Reply
Map
View

Click here to load this message in the networking platform