CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Process count

  1. #1
    Join Date
    Jan 2008
    Location
    India
    Posts
    408

    Question Process count

    Hello friends

    I want to count the number of currently running processes with a particular name. I did like this
    Code:
    Console.WriteLine(Process.GetProcessesByName("svchost.exe").Length.ToString());
    It returns 0.
    But actually 6 such processes are running. What's the fault?

    Regards
    Bharani
    Rate the posts which you find useful

  2. #2
    Join Date
    Jul 2005
    Location
    E: 120°.6, N: 31°.3′
    Posts
    795

    Re: Process count

    Advise that you do follow below step:
    1.) Search all process.
    2.) Find the process with specified name
    3.) count the number of step 2.)

    that's all.

    Good luck!
    Little by little one goes far
    Keep moving.......!
    Nothing is impossible !

  3. #3
    Join Date
    Jan 2008
    Location
    India
    Posts
    408

    Re: Process count

    Thanks a lot. It worked. Seems that .exe should not be specified. This worked!
    Code:
    Console.WriteLine(Process.GetProcessesByName("svchost").Length.ToString());
    Regards
    Bharani
    Rate the posts which you find useful

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured