Shutdown with no Dialog Thread last updated on 2003-08-15 12:01:17

Posted by member 33819 on 2003-08-12 07:48:18

Hi guys - my first post here, but have been using LS a while. been searching for a decent, active LS forum and I'm hoping this is it!

I'm interested in being able to shutdown/retart my pc via litestep without the need to use the windows dialog box.

!shutdown just brings up the dialog and id like to simply shutdown. this is mainly because im creating a theme and id like it to display its own shutdown message, fade out and shut down the pc from one shortcut/hotkey.

anyone know how to do what I want, please let me know.

Cheers!

Posted by member 202 on 2003-08-12 08:15:37 link

in xp and 2k you can do it using shutdown.exe command switches. bring up a command console and run 'shutdown.exe' for the usage.

in 9x, use the command (i'm on xp, so please somebody correct this if it's wrong)
RUNDLL32.EXE shell32 SHExitWindowsEx n

where n is one of the following:
0 = logoff
1 = shutdown
2 = restart
4 = forced
8 = power off


those commands can be bound to hotkeys, shortcuts, bangs, etc.

Posted by member 33819 on 2003-08-12 08:19:09 link

when I type shutdown.exe I get a message saying its not a recognized internal or external command. im on 2k here at work and XP pro at home.

Posted by member 202 on 2003-08-12 08:31:34 link

hm. ok look in your system root (c:\winnt\system32). if it's not there i'll upload mine somewhere. (it's for xp, but i think it should work on 2k. worth a shot, anyway.)

[update]
shutdown.exe is available on the win2k resource kit cd.

Posted by member 33819 on 2003-08-12 09:16:32 link

hmm cheers m8 I'll see if I can dig it out from somewhere...

Posted by member 33819 on 2003-08-12 09:23:34 link

Posted by member 202 on 2003-08-12 10:39:01 link

mahvelous. (if you want the microsoft version, it's here.)

Posted by member 33819 on 2003-08-12 13:22:20 link

hmm if i run it from a hotkey or popup it flashes up a command window. I kinda want it working in the background so I cant see it doing anything.

any ideas?

Posted by member 202 on 2003-08-12 21:20:50 link

not really, no (i'm assuming the functionality is working as it's supposed to, it's just not very pretty). sounds like normal operation. you could contact the author. or try the shutdown.exe from xp (which, supposedly, does work on 2k). or see if you can get the 2k version from someone with the resource kit.

*rummages around*

ah, here's something else. there is a utility on 2k and xp called tsshutdn.exe, originally designed to shut down servers. typing
tsshutdn /?

in a console will get you the command switches.
tsshutdn 0 /POWERDOWN /DELAY:0

should get you an immediate shutdown.

Posted by member 33819 on 2003-08-13 04:00:49 link

hmm i'll have a go. I tried both the XP and the downloaded shutdown last nite but didnt get either to work from my popup. they'd work in the cmd prompt but if I tried to specifiy full path and some flags in the popup entry it would fail to find the shutdown.exe.

hopefully tsshutdn will work. dont seem to have it on my win2k box though =(

Posted by member 2018 on 2003-08-14 00:18:22 link

just use laptop.dll and the !shutdown2 bang

Posted by member 33819 on 2003-08-14 04:11:23 link

just checked out the readme for laptop.dll...

!Shutdown2 ;shuts down your computer (bypasses the shutdown prompt)

looks like just what I want. will test it when I get home....

Posted by member 33819 on 2003-08-14 12:41:34 link

hmm laptop.dll seems to do nothing on my system (winXP). I assume it should work on desktop pcs as well as laptops??

Posted by member 202 on 2003-08-14 15:31:39 link

regarding shutdown.exe not working in popups: try moving your quotation marks around, or not having any. in my experience, things like
*CommandAlias email "mozilla.exe" -mail
and
*CommandAlias email "mozilla.exe -mail"

do not work, but removing the quotes entirely does.
*CommandAlias email mozilla.exe -mail

i would imagine it's the same across the board.

and yes, laptop.dll should work for desktops.

Posted by member 33819 on 2003-08-14 16:03:16 link

yeah I figured out the quotes bit. however the laptop.dll bangs arent working at all....it was written in 1999 ie pre-XP. could the shutdown API calls be different now?

Posted by member 202 on 2003-08-15 06:36:02 link

yeah I figured out the quotes bit

so did you get it working?

could the shutdown API calls be different

1999? yeah, that's probably the case. sorry, i should have seen that. *smacks forehead*

Posted by member 33819 on 2003-08-15 07:35:41 link

i got shutdown.exe working after I sorted the quotes, but it pops up a cmd promt window briefly and I want the shutdown to look seamless. My panels fade and display a shutdown message and want to shutdown without boxes appearing and stuff.

I searched for the C++ to shutdown windows and may have found the API call, but cant seem to get litestep to compile for me to begin work on my own module...

Posted by member 7223 on 2003-08-15 10:06:01 link

Posted by member 33819 on 2003-08-15 11:28:57 link

the problem is with these apps that take command line options is that they all throw up a command/dis window while they run. I want to be able to shut the pc down from within litestep with no dialogs, dos boxes or anything else.

laptop.dll seemed to be ideal but i think it doesn work on XP....I might email the author and see if he fancies updating it for me =)

Posted by member 7223 on 2003-08-15 11:43:03 link

Have you try poweroff ? I guess no !!!
When called with comand line options, I have no dialog, no DOS box; nothing at all. It just perform the desired action.

Posted by member 33819 on 2003-08-15 11:44:47 link

oh really? wicked! I'll give that go then m8 =D

Posted by member 33819 on 2003-08-15 12:01:17 link

well bugger me it works! no dialog, no command prompt, nothing!!

thanks for all your help guys - my theme is working really well now. =D