|
-
Sep 20th, 2001, 06:00 PM
#1
Thread Starter
Fanatic Member
Programs in Close Program menu
Is it possible to, when the user attempts to close my program using ctrl+alt+delete, have it stay open? If it is, is there also a way to disable it?
Alcohol & calculus don't mix.
Never drink & derive.
-
Sep 20th, 2001, 06:06 PM
#2
perhaps if you set a boolean and check if it is true when you catch the WM_DESTROY message?
I think that could work, but I am not sure.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Sep 20th, 2001, 06:17 PM
#3
Thread Starter
Fanatic Member
Yeah, that might work, but what about closing it after it's like that?
Alcohol & calculus don't mix.
Never drink & derive.
-
Sep 20th, 2001, 06:28 PM
#4
Well, if you check a boolean in the WM_DESTROY code, you can set it to true if you click a button or something, and that will allow you to use the PostQuitMessage() function, otherwise, just return 0.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Sep 20th, 2001, 06:59 PM
#5
Thread Starter
Fanatic Member
Thanks, I tried that and it worked. I just have one more question. Can I do it from another program? (I can do it with the process viewer by killing it, but is there another way?)
Alcohol & calculus don't mix.
Never drink & derive.
-
Sep 23rd, 2001, 04:37 AM
#6
hmmm, I don't see why you wanna do that, I mean the ctrl+alt+del is an emergency command and no program is supposed to ignore it.
But you can always kill any application with the TerminateProcess function, provided you get a handle to it. (process handle or instance handle)
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Sep 23rd, 2001, 12:16 PM
#7
Thread Starter
Fanatic Member
How can I get a handle to it? I don't see any function in MSDN except for GetCurrentProcess(), which doesn't seem like what I want. The application I am using this for is hidden, but it is visible in the Close Program box.
Alcohol & calculus don't mix.
Never drink & derive.
-
Sep 23rd, 2001, 12:29 PM
#8
OpenProcess
This will require the process ID, that you can get by GetCurrentProcessId and save somewhere.
Maybe you can also use FindWindow to get the window of your application and GetWindowLong to retrieve the instance handle. Instance handles and pocess handles are interchangeable (I think)
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Sep 23rd, 2001, 02:39 PM
#9
I remember reading somewhere that as part of Window's safety features, you can not simulate the pressing of ctrl+alt+del, nor can you prevent and App from being destroyed via ctrl+alt+del.
-
Sep 23rd, 2001, 03:11 PM
#10
you can at least simulate it. PC Anywhere does it.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|