Results 1 to 10 of 10

Thread: Programs in Close Program menu

  1. #1

    Thread Starter
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772

    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.

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    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

  3. #3

    Thread Starter
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772
    Yeah, that might work, but what about closing it after it's like that?
    Alcohol & calculus don't mix.
    Never drink & derive.

  4. #4
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    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

  5. #5

    Thread Starter
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772
    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.

  6. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    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.

  7. #7

    Thread Starter
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772
    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.

  8. #8
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    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.

  9. #9
    Megatron
    Guest
    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.

  10. #10
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    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
  •  



Click Here to Expand Forum to Full Width