Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding the processes running in the memory ???

Status
Not open for further replies.

isaisa

Programmer
May 14, 2002
97
IN
Hi,
I want to find out which all are the processes in the memory programatically. I am using windows 2000 as an operating system. I tried with EnumProcesses() function but i am getting the error. The file which i have included is "psapi.h" and "psapi.lib" added to project. The file could not open. I searched in the machine about availability of the header file mentioned but i did not get the header file on my machine.....

Please suggest what should i do ??? Also i want to use this application to be for windowsCE 3.0.

Suggest ASAP as this is urgent...

Thanks for suggestions in advance...

Sanjay
 
The MSDN library tells you the following about EnumProcesses ( ):

Requirements
Windows NT/2000/XP: Included in Windows NT 4.0 and later.
Windows 95/98/Me: Unsupported.
Header: Declared in Psapi.h.
Library: Use Psapi.lib.


This means, if you link statically, you can NOT run the program on 95, 98, ME and CE!!!


The MSDN library also says the following:
These functions are available in Psapi.dll, which is included in Microsoft® Windows® 2000 and Microsoft® Windows® XP. To use these functions on Microsoft® Windows NT® 4.0, you must obtain the redistributable version of this DLL.


It seems the EnumProcesses( ) API is quite new and I think you have an older Platform SDK installed, which doen't know these functions yet. A newer version or servicepack of the Platform SDK should be available at microsoft.com.


But, if you want your program to run on 95, 98, ME and CE as well, you must call EnumProcesses ( ) dynamic by:

1. Call LoadLibrary on psapi.dll
2. if 1. fails, give a message "not available"
3. Call GetProcAddress on the handle returned in 1. and "EnumProcesses".
4. If 3. fails, give a message "Not available"
5. Call it using the address returned in step 4.


Marcel
 
Sanjay,

I have been thinking about this. If you want a list of processes on CE, you might try EnumWindows, followed by GetWindowThreadProcessId on every window found. This will find all processes who did create a window.

Marcel

 
Hi Marcel,

Thanks for your help. I tried it on CE and i got it..On windows 2000 i am still stuck up...i am trying your suggestions to get the latest service pac.

Thanks again.
Sanjay
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top