When Windows automatically installs updates and automatically restarts, some programs (like Microsoft Word) come back up automatically and restore their original state (Word opens the same documents that were open previously). How can my program do this? Is there an API?
If it is a regular user-initiated restart I do not want my program to come back automatically - that would look weird to the user. But if the user leaves my program open when they go to bed and Windows reboots for updates in the middle of the night, I want the user to come back to their computer in the morning and still see my program running.
I care about Window 7 and above. I tagged the question as C#, since this is the language I am using, but if there is a solution in C/C++, I'll write appropriate glue code and post it here for others to use, too.