Closing an External Program

This is a discussion on Closing an External Program within the Windows Programming forums, part of the Platform Specific Boards category; Hi, I need to check if a particular program is running, if it is I need to close it. There ...

  1. #1
    Registered User
    Join Date
    Sep 2004
    Posts
    35

    Closing an External Program

    Hi,

    I need to check if a particular program is running, if it is I need to close it.

    There process does not generate a window, as it runs in the background.

    Someone suggested GetWindow, but I cannot get this to work.

    Any Ideas?

    Thanks

  2. #2
    Dump Truck Internet valis's Avatar
    Join Date
    Jul 2005
    Posts
    357
    well if you don't mind losing pre-nt compatability you can use the psapi.
    Call EnumProcesses, then call OpenProcess to get handles.

  3. #3
    Registered User
    Join Date
    Mar 2005
    Posts
    76
    nevermind
    Last edited by johny145; 08-03-2005 at 11:50 AM.

  4. #4
    Registered User
    Join Date
    Sep 2004
    Posts
    35
    I am having problems using psapi

    I have downloaded the MS Platform SDK which includes it.

    I have included the following in my program

    #include "C:\Program Files\Microsoft PlatformSDK\Include\psapi.h"

    It compiles, but will not link, what am I doing wrong?

    Thanks,

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Accessing Separate Program without Closing Immediately
    By LuckyDrawers17 in forum C++ Programming
    Replies: 1
    Last Post: 06-17-2009, 03:03 PM
  2. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 02:07 AM
  3. Calling external program and reading its output.
    By Dragoon_42 in forum C++ Programming
    Replies: 3
    Last Post: 10-18-2007, 05:34 AM
  4. How to restart a program without closing it...
    By D4050 in forum C++ Programming
    Replies: 16
    Last Post: 10-31-2001, 11:38 AM
  5. Compiler errors
    By BellosX in forum C Programming
    Replies: 2
    Last Post: 09-21-2001, 03:24 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21