Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Force a logoff when exiting app?
Message
From
20/10/2000 22:56:38
 
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00432368
Message ID:
00432404
Views:
29
>I use this code...
>
>* force user to logoff of network
>DECLARE INTEGER ExitWindowsEx IN Win32API INTEGER nFlags, INTEGER Reserved
>DECLARE INTEGER ExitProcess IN Win32API INTEGER nExitCode
>CLOSE ALL
>FLUSH
>=ExitWindowsEx(4,0)
>=ExitProcess(0)
>
>
>... to force a logoff. This works fine in NT, but when running on Win'98 and the user logs back onto the network, Windows Explorer opens up !!! Of course, this gives the users waaaaayyyyyyy too much access and must be stopped...
>
>But how? Is there a Win 98 version of the above code that I should use instead?
>
>TIA

It's an RTFM; the docs in the MSDN Library identify the problem, and give a solution:
Windows 95/98: Because of the design of the shell, calling ExitWindowsEx with EWX_FORCE fails to completely log off the user (the system terminates the applications and displays the Enter Windows Password dialog box, however, the user's desktop remains.) To log off the user forcibly, terminate the Explorer process before calling ExitWindowsEx with EWX_LOGOFF and EWX_FORCE.

You can use PostMessage() to shut down Explorer.

Ed
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