On a Windows 7 machine, when I run this code as a compiled program then the computer will randomly shutdown With an (Event ID 109 Kernel-Power) after 10 to 30 minutes. At the console a box pops up and says "The computer will shut down in less than a minute." This is not a crash. The computer knows it is going down. Warns the user and writes an event to the event log.
If I do not run this compiled code then the system stays up all day. If I start the program again, within a 10 to 30 minutes the computer will shut down.
On the XP machine there is no problem with shutting down.
My Code
This code functions exactly as it should, other than the unexplained shut down. As you can see there is nothing in my code to shut down the system. I don't see any run away loops or memory/cpu hogs. I can only figure that I've stumbled into a bug.
Event ID 109 Kernel Power
If I do not run this compiled code then the system stays up all day. If I start the program again, within a 10 to 30 minutes the computer will shut down.
On the XP machine there is no problem with shutting down.
My Code
;Opt("WinTitleMatchMode" ,2) #include <Array.au3> Opt("TrayIconHide", 1) sleep(5000) Global $_State Global $_pos[2] =[0,0] Global $_size[2] =[0,0] While 1 $_pos[0] = 1 $_pos[1] = 1 $_size[0] = 1 $_size[1] = 1 $_State = WinGetState("[CLASS:IEFrame]","") if $_State = 0 Then _Open() else $_pos = WinGetPos("[CLASS:IEFrame]") $_size = WinGetClientSize("[CLASS:IEFrame]") if $_size[0] < 1280 then _Resize() if $_size[1] < 1024 then _Resize() ; msgbox(1,"pos",$_pos[0] & @CRLF & $_pos[1],5) if $_pos[0] <> 0 then _Resize() if $_pos[1] <> 0 then _Resize() EndIf Sleep(5000) Wend Func _Open() if FileExists("C:\Program Files (x86)\Internet Explorer\iexplore.exe") then $_IE = Run("C:\Program Files (x86)\Internet Explorer\iexplore.exe") Else $_IE = Run("C:\Program Files\Internet Explorer\iexplore.exe") Endif Sleep(2000) EndFunc Func _Resize() WinActivate("[CLASS:IEFrame]") WinMove("[CLASS:IEFrame]", "", 0, 0, 1280, 1024) EndFunc
This code functions exactly as it should, other than the unexplained shut down. As you can see there is nothing in my code to shut down the system. I don't see any run away loops or memory/cpu hogs. I can only figure that I've stumbled into a bug.
Event ID 109 Kernel Power
Log Name: System Source: Microsoft-Windows-Kernel-Power Date: 10/10/2009 12:10:00 PM Event ID: 109 Task Category: (103) Level: Information Keywords: (4) User: N/A Computer: Fred Description: The kernel power manager has initiated a shutdown transition. Event Xml: <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event"> <System> <Provider Name="Microsoft-Windows-Kernel-Power" Guid="{331C3B3A-2005-44C2-AC5E-77220C37D6B4}" /> <EventID>109</EventID> <Version>0</Version> <Level>4</Level> <Task>103</Task> <Opcode>0</Opcode> <Keywords>0x8000000000000004</Keywords> <TimeCreated SystemTime="2009-10-10T16:10:00.925187500Z" /> <EventRecordID>5385</EventRecordID> <Correlation /> <Execution ProcessID="428" ThreadID="432" /> <Channel>System</Channel> <Computer>Fred</Computer> <Security /> </System> <EventData> <Data Name="ShutdownActionType">6</Data> <Data Name="ShutdownEventCode">0</Data> <Data Name="ShutdownReason">0</Data> </EventData> </Event>