Is it possible to prevent a program from being closed in a Windows domain?

  • Thread starter martix
  • Start date
  • Tags
    Program
In summary: Windows: - Use callbacks to handle the close button event.- Use DefWindowProc() to handle the WM_QUIT message.- Windows will handle the close button event.
  • #1
martix
162
1
I need to make a certain client program uncloseable(the best option). Or have it start itself every time someone closes it.
Any help?
 
Computer science news on Phys.org
  • #2
HOW would someone close it? You should be able to change the default frame so that it no longer has the cancel button.
 
  • #3
Although one might make the GUI inaccessible, one could still terminate the process (kill on linux, or task manager on Windows), if you have sufficient permission to use those tools.

One could try to run the process with higher level permissions... and maybe another program which periodically checks to see if the desired process is still running... restarting it if weren't.

Can you be more specific about what you want to run?
and who you want to prevent from stopping it?
 
  • #4
Er... I want people to be unable to exit the program from its GUI or window or whatever...
And I'll also go look how to disable the task manager.
 
  • #5
Your objective is a very bad idea.
 
  • #6
If you wrote the program or have the source code you can do it for most user activity.

The syntax varies by programming language.
The generalized solution:
Setup a callback function on the close button.
Issue a cancel message when the function gets control.
 
  • #7
symbolipoint said:
Your objective is a very bad idea.

I'll agree, but some places do this.
 
  • #8
goto phrack.com and search on invisible - there are ways to not appear in the process list in Windows. The suggestions about callbacks on some types of windows messages are good (called hooks usually). You will also have to make the program start on bootup. You are left with the problem of a user deleting the .exe, and rebooting. I'll leave it here.

A lot of this stuff is the stuff of rootkits. So most of first think very unkindly of this whole deal. I'm one of 'em.

Try phrack.
 
  • #9
jim mcnamara said:
A lot of this stuff is the stuff of rootkits. So most of first think very unkindly of this whole deal. I'm one of 'em.
I guess my opinion is that anyone capable of writing an operational hook isn't going to need to ask. It is simply a non trivial task to write one that doesn't blue screen you.

The idea has legitimate uses, say like a sales app on dedicated terminal or even the "Did you really want to quit without saving" message. In the former case you probably want to disallow the standard base window decorations like min, max and the close buttons.

Callbacks are offered by the instantiation of a GUI control (the hook is hidden in the class).

Hooks usually imply a direct connection into the O/S message queue (not unique to Windows) and often have callbacks.
 
  • #10
martix said:
I need to make a certain client program uncloseable(the best option). Or have it start itself every time someone closes it.
Any help?

I always ask myself the same problem. If you get something on this, please submit it (the link or some other source)! Thank you!
 
  • #11
Writing control systems for nuclear missiles, eh? :uhh:
 
  • #12
At least under Windows something like

Code:
switch (msg) 
{
  case WM_QUIT: return 0;

(...)

will disable close button. It doesn't mean program can't be closed, but it can become PITA :)
 
  • #13
Borek said:
At least under Windows something like

Code:
switch (msg) 
{
  case WM_QUIT: return 0;

(...)

will disable close button. It doesn't mean program can't be closed, but it can become PITA :)
Look can you be a more clear!
I wrote i program in C. Am i gonne introduce that code?
Another question is what does mean "PITA"?
 
  • #14
As for PITA - you better Google it. It has nothing to do with programming :smile:

[micorosoft windows specific]Each window has a window procedure, where messages/events send by the system are handled. If a window is sent WM_QUIT message it should close itself, it should the same receiving WM_CLOSE message. You don't have to handle these messages by yourself, standard procedure is to pass handling to DefWindowProc() which will do the trick. If you will not pass the message, users have problem closing window/program.[/microsoft windows specific]

Even if your program is a console application, there is a hidden window procedure, you just don't write nor controll it by yourself.

Note: I have not wrote native Windows program for ages, so my memory is a little bit shady on details. But the generall idea should be correct.
 
  • #15
No rootkits, I promise :) And NoTime is correct - if I could write a hook I wouldn't be asking here, would I... :)
Just a VPN client, a WebServer and the bunch that some people are not nice enough to leave alone to do their job.
I think I can make the Server Service Automatic, which should mean that you can't stop it from the GUI of the program, right?
And I think I can set the permissions of the other services so, that they can't be closed from the troublesome user.
My question is - are the permissions going to persist on restart?
OS is WinXP Pro SP2

And no, I could not find what PITA means...
 
  • #16
Pain in the a... :biggrin:
 
  • #17
Pita, n.
1. "An often round, brown, wheat flatbread made with yeast."
2. People Ingesting Tasty Animals?
3. See zeitghost, above. :rolleyes:
 
  • #18
Changing a active directory setting in a windows domain will do this. The user profile is tied to one program which is ran when the user logs in. When the program is closed, the user is logged out. This is very common in some businesses.

For example a denist that uses a vertical app for his whole business.
 

1. How can I make a program uncloseable?

There are a few ways to make a program uncloseable. One option is to use a programming language that has a built-in function for this purpose, such as Visual Basic or C#. Another option is to use a third-party tool or software that can prevent a program from being closed. You can also code your program to run in the background, making it invisible and uncloseable to the user.

2. Why would I want to make a program uncloseable?

There are a few reasons why you might want to make a program uncloseable. For example, if you are creating a kiosk or self-service station, you may want to prevent users from closing the program and accessing other applications. Additionally, if you are developing a critical system or application, making it uncloseable can prevent accidental shutdowns and ensure continuous operation.

3. Are there any drawbacks to making a program uncloseable?

Yes, there can be drawbacks to making a program uncloseable. For example, if a user needs to close the program for some reason, it can be frustrating and inconvenient for them if they are unable to do so. Additionally, if your program is not coded properly, it may cause system instability or crashes. It is important to carefully consider the purpose and potential consequences before making a program uncloseable.

4. Can someone still force close an uncloseable program?

It is possible for a determined user to force close an uncloseable program using various methods, such as using task manager or command prompt. However, making a program uncloseable makes it more difficult for a user to do so, and it may deter casual attempts to close the program.

5. Is making a program uncloseable ethical?

This is a subjective question and can depend on the purpose and context of the program. In some cases, making a program uncloseable may be necessary for security or operational reasons. However, it is important to consider the user's experience and ensure that the program is not causing any harm or inconvenience. It is also essential to inform the user that the program is uncloseable and provide a way for them to exit the program if needed.

Similar threads

Replies
6
Views
2K
Replies
7
Views
194
  • Computing and Technology
Replies
7
Views
500
Replies
21
Views
3K
  • Computing and Technology
Replies
3
Views
2K
  • Programming and Computer Science
Replies
7
Views
434
  • Computing and Technology
Replies
20
Views
2K
  • Computing and Technology
Replies
14
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
477
  • Computing and Technology
Replies
9
Views
1K
Back
Top