Link to home
Start Free TrialLog in
Avatar of aaagarb
aaagarb

asked on

How to prevent a program from terminating

I have written a program I want to run each time the computer is started. I do not want the user to be able to stop the program by going into the task list and deleting it.
I know that I can set something in the "on terminate" proceedure to react to this type of termination but I don't know what code to put there to prevent the termination.
Avatar of idcanada
idcanada


In the Form_QueryUnload event,
If UnloadMode = 2 then
Cancel = True.
end if

But before you do, have a public Boolean in your application.
Use this boolean to justify your actions to terminate the program in comparison to others.
Avatar of aaagarb

ASKER

thanks for responding but you're dealing with a novice here..
I put the first part of the code into the program in the query_unload event like you said.
The next part with the Boolean expression I havn't got a clue.
Can you be more specific..maybe write some example code and tell me where to put it in the program?
thanks.
ASKER CERTIFIED SOLUTION
Avatar of HATCHET
HATCHET

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of aaagarb

ASKER

this is not exactly what I needed but I think it will work.
If possible can you e-mail me your e-mail address? Maybe for slight modification on this?
mine is     bbender@cidcorp.com

thanks
HATCHET1998@Hotmail.com