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:

  1. the computer crashed on blue screen
  2. a user or program shutdown/restarted computer
  3. 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

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -