Solved

NT replacement for CreateToolhelp32Snapshot

Posted on 1998-06-10
6
244 Views
Last Modified: 2006-11-17
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
Comment
Question by:blevine
  • 2
  • 2
  • 2
6 Comments
 
LVL 15

Expert Comment

by:Tommy Hui
ID: 1165626
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
 

Author Comment

by:blevine
ID: 1165627
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
 
LVL 23

Expert Comment

by:chensu
ID: 1165628
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 15

Expert Comment

by:Tommy Hui
ID: 1165629
The information you seek about running tasks are all in the registry. They are stored in the performance data in NT.
0
 

Author Comment

by:blevine
ID: 1165630
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
 
LVL 23

Accepted Solution

by:
chensu earned 200 total points
ID: 1165631
No, you cannot use the same code.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MSVCR80.dll crash 2 134
returning a dereferenced pts in C++ 10 142
Move constructor only called if marked noexcept? 6 98
Should CArray be used for a list of pointers in C++? 19 97
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

895 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now