Shutdown Windows when pwd-protected screensaver is active...
Hi. I have an API question.
I'm using ExitWindowsEx function to shutdown Windows (usually Win2K). It is working fine, it shutsdown, restarts, etc. If a screensaver is active and password protected though, it does not work at all.
Is there a way to "persuade" Win2K to shutdown even if a password-protected screensaver is active?
I dont have a definate answer for ya unfortunately, but I wonder if it is possible to somehow find the threadID of the screensaver and kill it. I can remember a few years ago fooling around with a program called Sub7 (by mobman) which could do this remotely but that was very very naughty!!!
It is indeed a naughty solution but i don't believe it will solve my problem. I'm using Win2K and it is most probable that the screensaver "tells" the system to lock itself so killing the ss will not unlock the system. This might work on a Win98 system.
you're trying to shutdown windows while the workstation is locked isn't it ?
windows 2000 has no password protected screensavers, windows locks the workstation and then starts the screensaver.
And I don't know any way to unlock a workstation without entering a password.
Maybe you could try using the shutdown.exe windows has.
just try a bit arount with it by calling it from the commandline with the paramter /?
shutdown /?
You can also call that from visual by using the shell cmd.
Originally posted by Illuvatan
you're trying to shutdown windows while the workstation is locked isn't it ?
windows 2000 has no password protected screensavers, windows locks the workstation and then starts the screensaver.
Yes, that's what i'm trying to do... I know about all the things you mention here.
And I don't know any way to unlock a workstation without entering a password.
Maybe you could try using the shutdown.exe windows has.
Windows has no such exe AFAIK. Perhaps you are talking about a third-party utility. In any case, do you know of any utility which will shutdown the system, even if it has been locked?
That may help.. greetings UNI
Unfortunatelly it didn't but thanks for your thoughts anyway...
Keine Argumente Zeigt diese Meldung an (wie -?).
-i Zeigt eine grafische Benutzeroberfläche an (muss die erste
Option sein).
-l Abmelden (kann nicht mit der Option -m verwendet werden).
-s Fährt den Computer herunter.
-r Fährt den Computer herunter und startet ihn neu.
-a Bricht das Herunterfahren des Systems ab.
-m \\Computer Remotecomputer zum Herunterfahren/Neustarten/Abbrechen.
-t xx Zeitlimit fĂĽr das Herunterfahren, in xx Sekunden.
-c "Kommentar" Kommentar fĂĽr das Herunterfahren (maximal 127 Zeichen).
-f Erzwingt das SchlieĂźen ausgefĂĽhrter Anwendungen ohne Warnung.
-d [u][p]:xx:yy Grund (Code) fĂĽr das Herunterfahren:
u = Benutzercode
p = Code fĂĽr geplantes Herunterfahren
xx = Hauptgrund (positive ganze Zahl kleiner als 256)
yy = Weiterer Grund (positive ganze Zahl kleiner als 65536)
sorry but my Windows is in German...
This shutdown command triggers the window the blaster worm used to shutdown the computer. you will see a window that tells you that in a few seconds you computer will shut down.
try this in your cmd shell
shutdown -s -t 1000
your computer will then display that window an tell you that he will shutdown in 1000 seconds.
This can't be aborted without again using the shutdown command.
It works fine in Win2k advanced server (but I was logged as administrator)
It locks workstation and, after 1 second uses api to try to shutdown.
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
the shutdown.exe can be found on C:\Windows\System32\Shutdown.exe
can't understand why it's not there..
Hmmm. Probably this is the reason
AVAILABILITY
MKS Toolkit for System Administrators
MKS Toolkit for Developers
MKS Toolkit for Interoperability
MKS Toolkit for Professional Developers
MKS Toolkit for Enterprise Developers
MKS AlertCentre
Never mind. I'll try Cimperiali's code. Perhaps my problem has been solved...
...it should work, but I tried only as administrator...Let us know...
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
Originally posted by Cimperiali
...it should work, but I tried only as administrator...Let us know...
First of all, thanks for the help.
I tried the code. Here's what it does.
The call to ExitWindowsEx(EWX_FORCE, 0) causes the system to logoff, even though it was locked. (funny, i expected it to reboot/shutdown).
If i change the EWX_FORCE to EWX_REBOOT (which is what i actually want to do), it does nothing (probably because it's locked).
If i comment out the ExitWindowsEx call and call NtShutdownSystem directly, it shutsdown the system, and presents the screen which tells that it's safe to turn the power off.
Any comments on that?
P.S. I tried it as a domain user belonging to the local Administrators group (which is actually a PC administrator).
Last edited by Nick A.; April 21st, 2004 at 07:45 AM.
If ExitWindowsEx(EWX_POWEROFF Or EWX_FORCE, 0) = 0 Then
NtShutdownSystem SHUTDOWN
End If
Last edited by Cimperiali; April 21st, 2004 at 08:32 AM.
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.