forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Shutting Down Windows with VDS

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 4 Source Code
View previous topic :: View next topic  
Author Message
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Tue Dec 24, 2002 7:34 am    Post subject: Shutting Down Windows with VDS Reply with quote

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

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 4 Source Code All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group