[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

How to know if a process is running on WinNT

Posted on 2000-01-10
5
Medium Priority
?
157 Views
Last Modified: 2013-11-20
I need to know if a particular process  or application is loaded and running in the windows NT.

Thanks in advence
0
Comment
Question by:pinerio
  • 2
  • 2
5 Comments
 
LVL 8

Expert Comment

by:Vinayak Kumbar
ID: 2338467
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
 

Author Comment

by:pinerio
ID: 2338681
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
 
LVL 86

Accepted Solution

by:
jkr earned 300 total points
ID: 2338962
See

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

Expert Comment

by:jkr
ID: 2338972
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
 

Author Comment

by:pinerio
ID: 2340754
Thank you very much.
Thank you very much.
Thank you very much.

And.. have a nice day.
0

Featured Post

2018 Annual Membership Survey

Here at Experts Exchange, we strive to give members the best experience. Help us improve the site by taking this survey today! (Bonus: Be entered to win a great tech prize for participating!)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Hi, this video explains a free download that you can incorporate into your Access databases, or use stand-alone for contact management. Contacts -- Names, Addresses, Phone Numbers, eMail Addresses, Websites, Lists, Projects, Notes, Attachments…
Suggested Courses

607 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question