Serge Professional Member
Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Tue Dec 24, 2002 7:34 am Post subject: Shutting Down Windows with VDS |
|
|
You will find listed below the subroutine that i use in 2 of my programs to initiate the shutting down of Windows within VDS.
Code: |
rem === %%shutdown is read from the registry and determines how the
rem === user wants to shutdown windows. You will notice that there are
rem === several ways to shutdown Windows, some of which will only
rem === work with ME (that is what i have found anyway).
rem ===
rem === the %%beta part of the code is so that i can test the program
rem === without my computer actually shutting down. I set %%beta = yes
rem === when i test the program and i set %%beta = no when it is to
rem === run normally.
%%shutdown = @regread(root,exitwin,shutdown_mode)
%%exitwin_mode =
rem === processes shutdown procedure 1 ===
if @equal(%%shutdown,force 1)
%%exitwin_mode = force
elsif @equal(%%shutdown,logoff 1)
%%exitwin_mode = logoff
elsif @equal(%%shutdown,poweroff 1)
%%exitwin_mode = poweroff
elsif @equal(%%shutdown,reboot 1)
%%exitwin_mode = reboot
elsif @equal(%%shutdown,shutdown 1)
%%exitwin_mode = shutdown
end
if @not(@null(%%exitwin_mode))
if @equal(%%beta,yes)
info exitwin %%exitwin_mode
goto timer
rem stop
else
exitwin %%exitwin_mode
stop
end
end
rem === processes shutdown procedure 2 ===
if @equal(%%shutdown,shutdown 2)
if @equal(%%beta,yes)
info runh @windir()\rundll32.exe user.exe","exitwindows
goto timer
rem stop
else
runh @windir()\rundll32.exe user.exe","exitwindows
stop
end
end
rem === processes shutdown procedure 2 and 3 ===
if @equal(%%shutdown,force 2)
%%exitwin_mode = 4
elsif @equal(%%shutdown,logoff 2)
%%exitwin_mode = 0
elsif @equal(%%shutdown,poweroff 2)
%%exitwin_mode = 8
elsif @equal(%%shutdown,reboot 2)
%%exitwin_mode = 2
elsif @equal(%%shutdown,shutdown 3)
%%exitwin_mode = 1
end
if @equal(%%beta,yes)
info runh @windir()\rundll32.exe shell32.dll","SHExitWindowsEx %%exitwin_mode
rem stop
else
runh @windir()\rundll32.exe shell32.dll","SHExitWindowsEx %%exitwin_mode
stop
end
|
Enjoy!
Serge _________________
|
|