Thread: How to stop a aplication

  1. #1
    Registered User
    Join Date
    Sep 2004

    Question How to stop a aplication

    I have aplication A, it launch apliction B with ShellExecute.
    I want to stop aplication B from aplication A.
    Thanks for your time

  2. #2
    Registered User
    Join Date
    Sep 2004
    Send application B the WM_CLOSE message. If that doesnt close the application, then you can terminate the process. You can read more about this at:

  3. #3
    Registered User
    Join Date
    Sep 2004

    Angry I tried TerminateProcess but...

    The B process continues
    I tried: TerminateProcess("som1",NULL);
    Thanks for your time

  4. #4
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    >>I tried: TerminateProcess("som1",NULL);
    TerminateProcess does NOT take a string and a pointer. You need to get a HANDLE to the target process, and specify an unsigned integer for an exit code. I don't know how you can get a handle to the process if you're using ShellExecute(), although if you use CreateProcess() instead you can specify the process ID in a call to OpenProcess() to get the process handle.

    Once you have the handle, say theHandle, and an exit code, say exitCode with a value of 0:
    TerminateProcess(theHandle, exitCode);
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 06-14-2009, 11:24 PM
  2. fscanf %s or %d integer input space char stop question...
    By transgalactic2 in forum C Programming
    Replies: 5
    Last Post: 04-14-2009, 10:44 AM
  3. Error stop Http Listener
    By George2 in forum C# Programming
    Replies: 1
    Last Post: 06-04-2008, 02:14 AM
  4. when a while loop will stop ?
    By blue_gene in forum C Programming
    Replies: 13
    Last Post: 04-20-2004, 03:45 PM
  5. Telling other applications to stop
    By nickname_changed in forum Windows Programming
    Replies: 11
    Last Post: 09-25-2003, 12:47 AM