What code would I add to a program to make it so that the X in the top-right corner does not work, and is EDIT: I don't need it invisible to task manager.
But... how will the kernel know that it must allocate time slices to that particular process if you remove it from the process list? (bear with me a little, I just started learning that stuff)
AFAIK, that particular list doesn't do anything other than list running process for user level applications. The kernel doesn't keep internal state there, only a reflection of internal state.
EDIT: Oh, I just thought of something. You can't prevent a process from being killed, but you can "resuscitate" it if that happens. I call it "the Robin Hood design". http://catb.org/jargon/html/meaning-of-hack.html (third story)
looks like somebody's making a program thats intending to f*** up someones computer. ie. not let you close it while it works away at f'ing up the computer. nasty piece of work.
(i tried so hard not to swear. i'd rather not get reported)
Also may i ask what does your program do cos i can't think of any other reason why you wouldn't want the program to be closed.
You know how on Word, Dev C++, and other stuff how it stops the program from closing so it can say "Are you sure you want to exit?" or something like that? That's kind of what I want. (btw, I am not trying to screw up someone's computer. they could just turn it off if I was doing that.) Is it like system ("PAUSE") or something like that???
It's a bit suspicious since it could be used by malicious coders but there are many valid reasons for intercepting the close window button. E.G.: Needing to close file references or release external hardware. Or putting dangerous industrial equipment into a safe state before the program is allowed to release control.