Detecting StartUp/PC StartUp

So is there a way to make the program detect if the PC has just started up or when the app has just started up something different than the original time?
EG:

1
2
3
4
5
//Fresh Start or PC Restart
cout << "Welcome Back" << name << "How are you?";

//Normal Code
cout << "Today is a good day" << name << ".";


So the first time you run the program you'd see //Normal Code and then next PC Restart or next time you restart it you will see //Fresh Start or PC Restart
I get i can add the program as startup which isn't the issue, it's just changing what about it launches when you restart your computer thanks for reading
or as well it detects when the program is exiting or the pc shutting down and executes something different eg:
1
2
3
4
//Normal
system("del /f /q C:\\Users\\%USERPROFILE%\\Desktop\\badexit.txt");
//Other
system("del /f /q C:\\Users\\%USERPROFILE%\\Desktop\\goodexit.txt");
Last edited on
So is there a way to make the program detect if the PC has just started up or when the app has just started up something different than the original time?

You have to use modern libraries to achieve this and it is probably complicated. And it is very likely not cross-platform.
Topic archived. No new replies allowed.