what is the simplest way to kill or close or terminate an application?

Discussion in 'Win32' started by imported_chrono, Sep 14, 2007.

  1. imported_chrono

    imported_chrono New Member

    Joined:
    Sep 7, 2007
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    0
    as I searched online, the code fragment I found was hard to understand and the reason of that because I'm still new to windowAPI, so can anyone further explain or demonstrate how I would close the application?
     
  2. NewsBot

    NewsBot New Member

    Joined:
    Dec 2, 2008
    Messages:
    1,267
    Likes Received:
    2
    Trophy Points:
    0
    By sending the WM_CLOSE message to the Window Handle you would like to close, you will be able to close the application.
     
  3. SatK

    SatK New Member

    Joined:
    Feb 1, 2008
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    sending WM_CLOSE window message won't terminate application. It will jst close the window. You can use TerminateProcess which will unconditionally kill the threads of target process. Safe method of terminating a process is ExitProcess
     
  4. Mandeep Dey

    Mandeep Dey New Member

    Joined:
    Jul 14, 2008
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    You can use PostQuitMessage(0); with WM_CLOSE and WM_DESTROY and use enddilaog of application window before PostQuitMessage(0);
     
  5. johny10151981

    johny10151981 New Member

    Joined:
    Jul 7, 2010
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    0
    smart one.

    you can also use PostQuiteMessage(0) with any button or menu you want
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice