Using Task Manager to kill a defective program is not illegal use. When I evaluate a product that might be used by 30 or 40 users, I check it against common legal usage. If it gets in the way (as you describe in your first post) I will not buy it or recommend it. Words to the wise, and of course, proceed as you wish. ... Thinkpads_User

I know that. I think you are missing my point. ALL applications fail. Yours will too. It is not a matter of IF, it is a matter of WHEN, even if not your doing. When that happens I have no recourse except Task Manager -> Quit application or process. Your way, I must restart the entire machine when your application fails. Counter productive for me.

I realize we are on opposite sides of the street, but you are the seller, and I am the buyer with cash burning a hole in my pocket. Even so, I evaluate carefully and stringently.

And I have NEVER seen the application that didn't fail for one reason or another (even if my doing through, say lack of memory). But I do demand to have control over my own machine. When vendors take control (forbid back arrow, forbid reinstall, forbid forcing the app to close, and so on) then I just go elsewhere.
... Thinkpads_User

There's the On/Off button (whisper) which I occasionally hold in for 5 seconds to kill everything.

If you are concerned about saving results, when starting the program set an entry somewhere to indicate "Program Started", and when cloising the program delete this entry after saving the settings you mentioned. When starting the program, find out whether the "program started" entry, file, or whatever it is, exists - if it does then do whatever housekeeping is needed to recover from abnormal shutdown e.g., reindexing dbase indexes.

you have been asking this question over and over.
and you will never get the answer you want.

you are probably not saving the changes in the correct way.
You can kill any of my applications, at any time, i don't loose any data,
except the last transaction.
And nobody wants to keep a transaction of which the result is unsure.

As Geert implies, if you use a Timer component, you can commit the username, login name and logout time to a "persistent" location every time the Timer fires. By persistent I mean the registry, a file, or a database. You might say that the user is still logged in when you store the logout time like that, but you can differentiate a true logout from a timer generated one by having an extra piece of info - a boolean, which says whether the logout was an actual explicit logout or whether it was generated by the timer whilst the user was still logged in.

If using bde, paradox you really need to make the table active, post the data, then close it. If the table is posted to, then the power is turned off, the data may not have been committed to the table. Closing the table flushes the posted record from memory into the table on the hard drive. Failure to do this may mean that the last record is not in the table, and may also corrupt the table.

it's actually impossible for isam tables like paradox / dbase to do this.
you need a database with a database engine for this like oracle/mssql/firebird/interbase
these databases store a entry for each connection and can run a job periodically to check these connections
this job can determine via a ping or something a like if the connection is still active and thus update the database when the connection is lost

Just came across this thread because of a likewise question elsewhere. It seems that the asker is afraid of not being able to save anything when the user clicks "End Process". One common way of preventing loss of data when an unconditional kill occurs is to use a second process that monitors the first, possibly started as a service. This process then keeps handles open to objects not saved. It is however a lot of work and for someone deliberately killing a process, who deliberately sacrifices unsaved data, I'm not sure it is worth the trouble. But it is possible, though.

Alternatively, but I haven't tried this: the TerminateProcess API call which is done by TaskMgr is first notifying each DLL that the process is terminating (according to API docs). You may be able to act on that from inside your DLL (yet to be created) and save the state of your program.

I have my kid always play with the PSU power button and I have no UPS at home. tow days a go I worked like for 3 hours on a delphi source code and didn't save anything, I went to the bathroom and when I back ... a black screen and the pc is turned off

> when killing a process with the task manager from the processes list, the app does not get notified

"End task" >>> you can still react. Is equal to the little cross, or alt-F4, or WM_QUIT (this is the Applications list, not the Processes list).

"End process" >>> you can do little about it, apart from the DLL-approach, the API hook explained in the beginning of this thread, and the "process monitor" approach ("end process" is in the Processes list)

indeed, 100% guarantee is not possible, but you can get close. Certain medical systems, embedded software for security, i.e., cars, railway crossovers, nuclear power plants, or simpler, the software inside your washing machine will go to great lengths not to have data loss they cannot recover from. But these systems won't run windows ;-)

Featured Post

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention. Check out this how-to article for more information.

Introduction
Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview. I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…

In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work. Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…

This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…

In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…