is there a way to know if a certain program is running?

This is a discussion on is there a way to know if a certain program is running? within the C Programming forums, part of the General Programming Boards category; Hi, I was just wondering if there was a way to know if a certain program(a DOS window) is open ...

  1. #1
    Registered User Commander's Avatar
    Join Date
    Sep 2001
    Posts
    804

    is there a way to know if a certain program is running?

    Hi, I was just wondering if there was a way to know if a certain program(a DOS window) is open or not. If there is, would you guys please tell me. It would be a big help!
    thankx!
    oh i'm sorry! i didn;t realize my fist was rushing to meet ur face!

    MSN :: commander_android@hotmail.com []*[]

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826

    Re: is there a way to know if a certain program is running?

    Originally posted by Commander
    Hi, I was just wondering if there was a way to know if a certain program(a DOS window) is open or not. If there is, would you guys please tell me. It would be a big help!
    thankx!
    Look at your start bar. Do you see it there? If so, it's running. Use your task manager. Does it show up there? If so, it's running.

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Unleashed
    Join Date
    Sep 2001
    Posts
    1,765
    OUCH

    To me, Quzah answered your question perfectly.
    Obivously ( or atleast I hope ), this is not what you were talking about.

    When will people realize that you need to be specific about programming?

    If you asked "god" to sum up how he created the earth in one or 2 sentances, he couldn't. This is the same concept.
    The world is waiting. I must leave you now.

  4. #4
    Registered User Commander's Avatar
    Join Date
    Sep 2001
    Posts
    804
    Sorry about that! I was kinda asking if there was a way to write a code that would determine if a certain program was open or not...Help anyone?
    thnkx!
    oh i'm sorry! i didn;t realize my fist was rushing to meet ur face!

    MSN :: commander_android@hotmail.com []*[]

  5. #5
    Registered User toaster's Avatar
    Join Date
    Apr 2002
    Posts
    161
    ugh, I don't know the Win API function that does this. sorry.
    think only with code.
    write only with source.

  6. #6
    Unleashed
    Join Date
    Sep 2001
    Posts
    1,765
    I was kinda asking if there was a way to write a code that would determine if a certain program was open or not...Help anyone?
    I do not know how to do this myself.
    I haven't personally had the need for something like this.
    It might be useful in the case of updating and old version of a program, for say an installation or something.

    > Sorry about that!
    Thank you for realizing you need to be clear.
    The world is waiting. I must leave you now.

  7. #7
    Me want cookie! Monster's Avatar
    Join Date
    Dec 2001
    Posts
    680
    I'm not sure but once I made a program like spy++ (utility that gives you a graphical view of the system’s processes) using the GetTopWindow, GetNextWindow, FindWindow, etc functions. Maybe you can use these functions.

    Cheers, Monster

  8. #8
    Registered User billholm's Avatar
    Join Date
    Apr 2002
    Posts
    225

    Cool

    Well Monster has a point.

    But i think you need to implement interrupt vector routines in your program (Borland/Turbo C/C++).

    All men are created equal. But some are more equal than others.

    Visit me at http://www.angelfire.com/my/billholm

  9. #9
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    In a windows environment, EnumProcesses() would be a good start....but you need to be sure of the procedure and you need a decent version such as 2000 or XP..........

  10. #10
    Registered User billholm's Avatar
    Join Date
    Apr 2002
    Posts
    225

    Lightbulb

    Yah that too!
    All men are created equal. But some are more equal than others.

    Visit me at http://www.angelfire.com/my/billholm

  11. #11
    Registered User Commander's Avatar
    Join Date
    Sep 2001
    Posts
    804
    Does anyone have any examples of how to use those functions?
    oh i'm sorry! i didn;t realize my fist was rushing to meet ur face!

    MSN :: commander_android@hotmail.com []*[]

  12. #12
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590
    Obviously you can do this in any Windows, including Win 3.0 since the Program Manager lists the current running tasks.

    Check the SDK. I'm sure there is an API call combined with callback function for this.

  13. #13
    Registered User billholm's Avatar
    Join Date
    Apr 2002
    Posts
    225

    Talking

    Sorry Commander, I can't present any code yet.

    I still have to dig deeper into systems programming. Till then I can only surmise.

    All men are created equal. But some are more equal than others.

    Visit me at http://www.angelfire.com/my/billholm

  14. #14
    Registered User
    Join Date
    Oct 2002
    Posts
    21

    I would like to know also

    i dont know how to answer the question you asked. I think i might be able to be a little more specific.

    ok here I go.
    PHP Code:
    BOOL GetClassInfo
              
    HINSTANCE hInstance
              
    LPCTSTR lpClassName
              
    LPWNDCLASS lpWndClass
              
    ); 
    This is the function i want to use.
    What i want to do is use GetClassInfo();, inside a loop, to check the caption of all the windows.
    Then when i find the window with what i'm looking for (i.e. " - WinProxy")
    or when i don't find it... take action.
    My Question is, how do i get the hInstance of all the different windows?
    hope this helps Commander.

  15. #15
    Unleashed
    Join Date
    Sep 2001
    Posts
    1,765

    gavedigging

    Please don't gravedig.
    The world is waiting. I must leave you now.

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program running long
    By smarta_982002 in forum Windows Programming
    Replies: 3
    Last Post: 03-27-2008, 05:24 AM
  2. Running my program in the background
    By shoobsie in forum Windows Programming
    Replies: 4
    Last Post: 10-09-2005, 02:38 AM
  3. Replies: 3
    Last Post: 09-05-2005, 08:57 AM
  4. Why is my program running away?
    By badkitty in forum C++ Programming
    Replies: 4
    Last Post: 09-19-2001, 04:27 PM
  5. Running program
    By muffin in forum C Programming
    Replies: 5
    Last Post: 08-30-2001, 10:57 AM

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