Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How can i detect that the system has just restarted/powered on

How can i detect that the system has just restarted/powered on

Scheduled Pinned Locked Moved C / C++ / MFC
question
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kim Togo
    wrote on last edited by
    #1

    Hi.. Is it possible to detect that Windows has restated or has just been powered on? Kind regards /Kim

    D D 2 Replies Last reply
    0
    • K Kim Togo

      Hi.. Is it possible to detect that Windows has restated or has just been powered on? Kind regards /Kim

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Not unless you already have an application up and running to detect such an event. Check out the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run registry key.


      "Money talks. When my money starts to talk, I get a bill to shut it up." - Frank

      "Judge not by the eye but by the heart." - Native American Proverb

      1 Reply Last reply
      0
      • K Kim Togo

        Hi.. Is it possible to detect that Windows has restated or has just been powered on? Kind regards /Kim

        D Offline
        D Offline
        Dimitris Vikeloudas
        wrote on last edited by
        #3

        What you mean by has just been powered Just is an inaccurat term. If you mean that you have an application violently terminating due to system shutdown and restart then your application should leave enough traces to recover itself. I suppose that Win32 will have an interface to give you the latest loggin time of the current user if that's help.

        K 1 Reply Last reply
        0
        • D Dimitris Vikeloudas

          What you mean by has just been powered Just is an inaccurat term. If you mean that you have an application violently terminating due to system shutdown and restart then your application should leave enough traces to recover itself. I suppose that Win32 will have an interface to give you the latest loggin time of the current user if that's help.

          K Offline
          K Offline
          Kim Togo
          wrote on last edited by
          #4

          The problem is. I have made a Win32 service application witch is set to automatic start up. For some reaches, the application unexpectedly terminates. But when I start the application with Service Manager is starts with out errors. But I have thought about this function, witch can tell me how long the system has been up an running. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/gettickcount.asp Then I will try to make a delay for about 10 seconds. when system up time is less then 10 minutes. /Kim

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups