Bekz.net - (14016 of 825956 - 2%) 

 Home | Tips & Tricks | General Info | Downloads | NG Archive | Links | Email | Search | Register | Users | Login

 


 

Tips & Tricks

 

Rating: 80% (2 votes registred)
Rate this item:

Back to list

How can I restart Windows from within FiveWin?

The program RunDll32.exe calls the function SHExitWindowsEx in Shell32.dll.
The function requests one parameter, which must be a string defining a
hexadecimal number for the exit mode. The string must be written as 0x0...
The string 0x0 defines the value 0, 0x01 defines 1 and so on.
SHExitWindowsEx reads this parameter, converts it to a hexadecimal value and
calls the API-function ExitWindowsEx. The following table specifies the
values you may use:

CommandRemark
Shell32.dll,ExitWindowsEx,0x0Logoff
Shell32.dll,ExitWindowsEx,0x1Shutdown
Shell32.dll,ExitWindowsEx,0x2Restart

Sample code:

Function ExitWindows(nWhatToDo)
LOCAL cWhatTDoDo

DO CASE
   CASE nWhatToDo = 1
        cWhatToDo:="0x0" // Logoff Windows
   CASE nWhatToDo = 2
        cWhatToDo:="0x1" // Shutdown Windows
   CASE nWhatToDo = 3
        cWhatToDo:="0x2" // Restart Windows
   OTHER
        RETURN MsgStop(Str(nWhatToDo)+" is not a valid option.")
ENDCASE
  
WinExec(  "RunDll32.exe Shell32.dll,SHExitWindowsEx "+cWhatToDo )

RETURN NIL

 

 

 

 

© 2002 Bekz.net, Inc. All Rights Reserved.