Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 274
  • Last Modified:

NT replacement for CreateToolhelp32Snapshot

I use the MODULEENTRY32 structure to find out what processes are running in Windows 95 (see code below).  How can I do the same thing in Windows NT?????
***********************************************************
HANDLE hwsnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, 0);  
proentry.dwSize = sizeof(MODULEENTRY32);
BOOL bw = Module32First(hwsnap, &proentry);
CString stemp;      
//Loop through all processes entry
if (bw)
{
     while(1)
     {
      stemp = proentry.szExePath;
      if(!Module32Next(hwsnap, &proentry                  {
           break;
      }
}
CloseHandle(hwsnap);
0
blevine
Asked:
blevine
  • 2
  • 2
  • 2
1 Solution
 
Tommy HuiEngineerCommented:
To do the same in Windows you will need to read the registry. I recommend you search the online help (I think you may need MSDN)for
  performance and pietrek

to find an article written by Matt Pietrek for MSJ about it.
0
 
blevineAuthor Commented:
The processes I want to check for are not necessarily in the registry.  I am talking about locally written applications and DLLs in which we avoid using the registry whenever possible.
0
 
chensuCommented:
The process status helper functions make it easier for you to obtain information about processes and device drivers running on Microsoft Windows NT. These functions are available in PSAPI.DLL, which is distributed in the Microsoft Platform Software Development Kit (SDK) (http://www.microsoft.com/msdn/sdk). The same information is generally available through the performance data in the registry, but it is more difficult to get to it. Take a look at the KB article http://support.microsoft.com/support/kb/articles/q175/0/30.asp. Also, take a look at the SDK Tool Windows NT samples "Pviewer: Process Viewer" and "Tlist: Task List".

Windows NT 5.0 and later support Tool Help Library.
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
Tommy HuiEngineerCommented:
The information you seek about running tasks are all in the registry. They are stored in the performance data in NT.
0
 
blevineAuthor Commented:
If my application has to run on Window 95 and Windows NT, do I have to use separate code for each or is there a way to accomplish this in both with the same code?
0
 
chensuCommented:
No, you cannot use the same code.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now