I'm trying to develop a C++ MFC application which runs in background (in Windows) and I have one question that I can't find a complete response.
How do I to detect when the user try to close it via Task Manager by killing process, when it would be closed by shutting down the computer and when the computer in which this app runs crashs ?
Knowing that I have an external Database (SQL Server 2008) with which this app interacts.