Hi all,

I'm stuck. I'm trying to find a good way to keep a program from being quit without authorization on a windows 2000 system. Now I could do it on 9x with the SystemParametersInfo by setting the flag SPI_SETSCREENSAVERRUNNING -- but this was just a cheap trick (which I don't believe works with 2000)

So my question: Is there another way to prevent logging out of a program either by administrative settings or through programming?

note: I perfer not to have to create my own device driver to hook keyboard inputs... So anything would be helpful in this regard

Sliver
Posted on 2003-04-17 11:47:03 by Sliver
You can prevent it being shut down by normal users by running it as a service, however you won't be able to have a user interface while running as a service.

If you do have a UI, you could intercept the WM_CLOSE message, check the security context of the current user, and if the user is not in the admin group then cancel the WM_CLOSE. This method is not totally reliable, as the user could still use the task manager to shut the app down.
Posted on 2003-04-17 17:42:43 by sluggy

This method is not totally reliable, as the user could still use the task manager to shut the app down.


Not if you block this.

See: http://internals.com/utilities/winnt/stickyapp32/StickyApp32.zip
Posted on 2003-04-17 19:44:16 by bazik
I can imagine some instancies where it might be better to have a second application which insures the first is running. This would allow the user to quit (reset) the application in the event of a problem, but also gaurantee an instance of the program is running. This second application could be run as a service as suggested by sluggy.
Posted on 2003-04-17 20:07:35 by bitRAKE