Startup and Shutdown

Startup and shutdown - does anyone know where in the registry I make an
entry to make my program run automatically on startup. I would also like
for the user not to be able to shut it down, unless windows is closing.
Placing the prog in the startup directory works, but the naughty users
sometimes delete it. I tried onclose query and told it never to close, but
then windows can't shut down.

--
The registry key to run an application at start up is :
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\VurrentVersion\Run.

As far are shuting down or the prevention of shuting down Windows is
concerned....

Windows send a Message WM_CLOSEQUERY (or QUERYCLOSE) to all running apps.
Any of the running apps can prevent the closure of windows. Which is what
your application is doing.

What you need to do is prevent the user from closing your application by
setting a flag within your application. So unless he is allowed to close it
it will not close, but at the same time you should not use the OnCloseQuery
event.

In other words your application will close only if the flag is set or
Windows is trying to shut down.