Jump to content

Shutdown (14) not working on XP, but works on Vista


 Share

Recommended Posts

I have a program where I have the option of clicking shutdown or rebooting after some maintenance. On XP systems, the reboot option does not work (it shuts down instead). The "Exit" is there as the program will try to go to the other options while shutting down if any other functions were clicked on the GUI while maintenance is runnnig and it gets noted in the log file.

Here is the pertinent code below:

Func _OnExit ()

GUICtrlSetData($progressbar, 100)

If $OnExit = "Reboot" Then

GUICtrlDelete ($Message)

$MessageText = "Rebooting: " & @MON & "/" & @MDAY & "/" & @YEAR & " - " & @HOUR & ":" & @MIN & ":" & @SEC

$Message = GUICtrlCreateLabel($MessageText, 64, 117)

$ConfigureReadLog = FileOpen($log, 1)

FileSetAttrib($log, "-R")

_FileWriteLog($log,"Rebooting", 1)

_FileWriteLog($log,"--------------Program Ending---------------", 1)

FileSetAttrib($log, "+R")

FileClose($ConfigureReadLog)

Shutdown (14)

Exit

Else

GUICtrlDelete ($Message)

$MessageText = "Shutting Down: " & @MON & "/" & @MDAY & "/" & @YEAR & " - " & @HOUR & ":" & @MIN & ":" & @SEC

$Message = GUICtrlCreateLabel($MessageText, 64, 117)

$ConfigureReadLog = FileOpen($log, 1)

FileSetAttrib($log, "-R")

_FileWriteLog($log,"Shutting Down", 1)

_FileWriteLog($log,"--------------Program Ending---------------", 1)

FileSetAttrib($log, "+R")

FileClose($ConfigureReadLog)

Shutdown (13)

Exit

EndIf

EndFunc

Link to comment
Share on other sites

Unless Vista added some shutdown codes it shouldn't work on anything. Take a look at the Flag values again and show me a usable combination that totals 14.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

2 = Reboot

4 = Force

8 = Power down

= 14

Reboot and Power Down are not compatable flags.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...