winapi - How can I get the Windows last reboot reason -
i'd know windows api function (if exists) provides information last windows reboot source. there 3 main possible causes:
- the computer crashed on blue screen
- a user or program shutdown/restarted computer
- a power lost
the more details can better. however, need know @ least reason main ones.
i need support windows vista , windows 7.
answer:
it seems there no direct api information. instead, have harvest windows event log. system reboot information located in event viewer/windows logs/system. here various information provided event ids:
- 6005: windows start-up
- 6006: windows shutdown (properly)
- 6008: windows shutdown (unexpectedly)
i not yet difference between power lost , system crash, it's start.
take @ event log api. case a) (bluescreen, user cut power chord or system hang) causes note ('system did not shutdown correctly' or that) left in 'system' event log next time system rebooted properly. should able access programmatically using above api (honestly, i've never used should work).
Comments
Post a Comment