0

I'm using a Windows Forms application to send data to a database. When a database operation fails, I append the data/operation to a local file. This file is processed line by line when restarting the software (and using a timer). When user clicks the exit button a warning is shown " processes are finished and the app closes in some seconds". However sometimes the user finishes the app using task manager. Using win 10 it seems not to be possible to react on this cancellation. All I want to do is to copy the lines of the file that weren't processed yet back to the original file. Is there any way to achieve this?

purbsel
  • 307
  • 8
  • 21
  • There's nothing you can do in the event of someone killing a process from Task Manager (see https://stackoverflow.com/questions/12313126/detect-end-process-from-task-manager-in-c-sharp). – auburg Oct 18 '19 at 08:39
  • You could have the action part of the code running in a service, which the UI communicates with via RPC/Pipes/TCP/Dll whatever. If this service runs under some sort of administrator account, then a 'user' can't kill it. – Neil Oct 18 '19 at 08:51

0 Answers0