Sign in to follow this  
Followers 0
azwildcat

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

7 posts in this topic

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

Share this post


Link to post
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!"

Share this post


Link to post
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.

2 = Reboot

4 = Force

8 = Power down

= 14

Share this post


Link to post
Share on other sites

14 is a bad flag combo. So I guess Vista reads it one way and XP reads it another way.


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
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!"

Share this post


Link to post
Share on other sites

Reboot and Power Down are not compatable flags.

Thanks George...change to Shutdown(6) and worked perfectly!

Share this post


Link to post
Share on other sites

Reboot = restart the computer. AKA, ctrl+alt+del; alt; u; r; as in, turn it off, and then on

Power down = shut down COMPLETELY.

what the hell are you trying to acheve here? ;)

Share this post


Link to post
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
Sign in to follow this  
Followers 0