Reputation: 7325
I mean preventing any action closing-unloading-terminating they all should be prevented until the code finishes working..
Esspecially termination should be canceled until code finishes working..
I want to do this to create a very important .log file and with it moving some files between folders so i must prevent the guy that thouches everything in server without knowing a thing about and being called as system administrator from stopping this action just cause he doesnt like it to run in the background (if u got what i mean). Cause im having log about that server and moving files which can cause data loss. Im pretty sure most of the programmers lives trough such unnecessary thrust problems with old people and i need help to deal with this situation.
So how can i achive that in vb6?
Upvotes: 0
Views: 293
Reputation: 24253
While you can stop the user from trying to close the application by handling the QueryUnload
event (assuming you call DoEvents
periodically) there is nothing you can do to stop someone with full admin rights killing your process outright.
Upvotes: 2
Reputation: 10570
You probably need to redesign your application logic to allow terminating your process at any stage - move files by rename_src-copy-rename_tgt-delete_src operations, close log file after each event written etc etc. Ideally you should be able always identify which operations are done purely on info, provided by file system (file names etc). There are cases when terminating process is required, after all.
Otherwise, if your application has visible window, you can track Form_QueryUnload events and just cancel unload. Of course this doesn't prevent killing your app from task manager processes view.
Upvotes: 3