Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There is an example of how to use <code>CreateToolhelp32Snapshot</code>, <code>Process32First</code>, <code>Process32Next</code> (You have to add error handles, etc. and include <code>tlhelp32.h</code> in your code). By the way this functions are not compatible with Windows NT:</p> <pre><code>BOOL GetProcessList(const char *processname, DWORD **processIds, int *numprocess) { HANDLE hProcessSnap; PROCESSENTRY32 pe32; DWORD *processIdsTmp; *processIds = NULL; *numprocess = 0; // Take a snapshot of all processes in the system. hProcessSnap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 ); if( INVALID_HANDLE_VALUE == hProcessSnap ) return( FALSE ); // Retrieve information about the first process, // and exit if unsuccessful if( !Process32First( hProcessSnap, &amp;pe32 ) ) { CloseHandle( hProcessSnap ); // clean the snapshot object return( FALSE ); } do { if (0 == strcasecmp(processname, pe32.szExeFile)) { processIdsTmp = realloc(*processIds, sizeof(DWORD) * ((*numprocess) + 1)); if (NULL == processIdsTmp) { free(*processIds); *processIds = NULL; *numprocess = 0; CloseHandle( hProcessSnap ); // clean the snapshot object return( FALSE ); } *processIds = processIdsTmp; (*processIds)[(*numprocess)++] = pe32.th32ProcessID; } } while( Process32Next( hProcessSnap, &amp;pe32 ) ); CloseHandle( hProcessSnap ); return( TRUE ); } </code></pre> <p><a href="http://msdn.microsoft.com/en-us/library/ms686701%28v=vs.85%29.aspx" rel="nofollow">here</a> is a complete example of the use of this funcions.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload