Thema: Delphi System Reboot Counter

Einzelnen Beitrag anzeigen

Benutzerbild von dummzeuch
dummzeuch

Registriert seit: 11. Aug 2012
Ort: Essen
1.468 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#12

AW: System Reboot Counter

  Alt 15. Apr 2019, 08:20
OK, as far as I understand you want your program to execute an action on every second reboot.

This is how I would implement this:

* Add your program to the autostart.
* When it starts, read the reboot counter mentioned above. Compare it to your own registry entry (under HKCU\Software\<your company>\<your program>).
* If your entry does not exist, assume that this is the first time your program was started, execute the action.
* If your entry exists, compare its value to the reboot counter. If the difference is <=1 skip the action, otherwise excute the action.
* Write the reboot counter to your registry entry and exit.

Note that this will only work if it is always the same user who works on that computer. Otherwise you will need keep your own counter somewhere else but HKCU, because that entry is user dependent.
Thomas Mueller
  Mit Zitat antworten Zitat