In a command-line application that is single-threaded, I want to know when the user closes (by clicking on the red cross in the upper right corner) turning off the computer or logging out without leaving my application so that I can clear the cookies that I store in the windows registry.
Is it possible to find out when the user completed the events mentioned above and called the function in my application or called a separate EXE or batch file after the event?
I need this functionality because I want to prevent a possible scenario when the registry is full of unwanted trash created when the application exited incorrectly.
Since my application runs on the command line, for example C:\Users\admin\Desktop>Application.exe -task "ConnectServer" --ip 127.0.0.1 , Iām looking for a way to effectively manage cookies and delete cookies after how did you catch the events mentioned above.
source share