1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Close Exe File Using Visual C++

Discussion in 'MFC' started by masanka, Jan 16, 2008.

  1. masanka

    masanka New Member

    Joined:
    Dec 26, 2007
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    Hi All
    Please tell me how to close an EXE Using visual C++.This EXE is an separate EXE file

    EX.
    ABC.exe and XYZ.EXE
    I am Runing XYZ.exe Using ABC.EXE (In ABC.EXE Shell command) I want close this XYZ.EXE
    using ABC.EXE in VC++

    Please help me

    Thanks
    masanka
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,292
    Likes Received:
    365
    Trophy Points:
    83
    Use the FindWindow to get the handle to the EXE running and send the WM_CLOSE / WM_QUIT message and it should close the running exe.
     
  3. masanka

    masanka New Member

    Joined:
    Dec 26, 2007
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0

    Hi
    Please Tell me how can do this I am beginer for the VC++ and i want close Word document file In Same time (abc.doc) Simply word exe file

    Thanks
    masanka
     
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,292
    Likes Received:
    365
    Trophy Points:
    83
    Code:
    HWND hWnd = ::FindWindow(NULL,"abc.exe");
    ::SendMessage(hWnd,WM_CLOSE,0,0); 
    
    Here is the sample pseudo
     
  5. masanka

    masanka New Member

    Joined:
    Dec 26, 2007
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    Tahnk You Very Much For ur Reply

    masanka
     

Share This Page