I have a program that logs whenever it is shutdown. I can capture that process if the user simply closes the application or uses the "end task" option in the task manager.
if they use the task manager "End Process" then, naturally, the program cannot detect that. Therefore, I used a bit of creative logic. When the program opens, it sets a flag in a file. When it closes it sets the flag to something else. Therefore, when the program opens up the next time, if the flag isn't set to the proper value, the program concludes it was forced closed such as with the End Process option of task manager.
The problem is if the user has their pc freeze up and has to do a cold boot, the software shows this as an abnormal shutdown. Due to the nature of the program, such a false recording can have severe negative effects.
What can I do so my program can detect an "End Process " Using a secondary application might be considered if you can explain how the two can be used in conjunction. OR, as a more general question, what can I do to differenciate a freeze-up from a program End Process