How to know if a process is running on WinNT

I need to know if a particular process  or application is loaded and running in the windows NT.

Thanks in advence
pinerioAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Vinayak KumbarSr Program ManagerCommented:
Hi,

It is possible using EnumWindows().

Do the following

1. Declare the function as global as
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lparam);

2. Whenever U want ot find the window do the following
EnumWindows((WNDENUMPROC)EnumWindowsProc , 0);

3. Add the function as
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lparam)
{
      //Declare storage for Window Title
      char l_chTitle[300];
      memset(l_chTitle, 0, 300);
      ::GetWindowText(hwnd, l_chTitle, 200);

      CString l_strTitle = l_chTitle;

      if(!l_strTitle.IsEmpty())
      {
            if(l_strTitle.Find("list") != -1)
            {
                  //Got the app
                  return 1;
            }
      }

      return 0;
}

Here I am assuming that, that perticular app has the window name as "list". U can give the title name here.

Now depending on the return value of that function u can decide, whether that window is there or not.

Hope this helps.
VinExpert
0
pinerioAuthor Commented:
Thank you very much,VinExpert, but I need another aproach to the problem.
I'm not looking for a windows name, I'm looking for a NT process. As you know the process does not necessary has a window. More than that, a window title does not need to be the same than the aplication's name.
0
jkrCommented:
See

 HOWTO: Enumerate Applications in Win32
 http://support.microsoft.com/support/kb/articles/Q175/0/30.ASP  
 
 
   
 
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jkrCommented:
Ooops, almost forgot: http://www.codeguru.com/win32/ps.shtml ("Process Status for Win9x and NT") is a good resource for this issue, too...
0
pinerioAuthor Commented:
Thank you very much.
Thank you very much.
Thank you very much.

And.. have a nice day.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.