TASK MANAGER abfragen
-
Was hat nicht geklappt?
-
char *pcPrg = "c:\\Programme\\ISS\\Proventia Desktop\\AgentRemove.exe";
STARTUPINFO si;
PROCESS_INFORMATION pi;ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );CreateProcess( NULL, pcPrg, NULL, NULL, FALSE, 0, NULL, NULL,
&si, &pi );for (;;)
{
if ( WaitForSingleObject( pi.hProcess, 0 ) == WAIT_OBJECT_0)
{
break;
}
}hiermit den Prozess abfragen
-
Was willst Du denn damit abfragen?
Damit startest Du nur einen neuen Prozess und wartest bis er sich beendet hat...
-
trivial schrieb:
for (;;) { if ( WaitForSingleObject( pi.hProcess, 0 ) == WAIT_OBJECT_0) { break; } }Woher hast Du denn diesen miserablen Code???? Busy-Wait ist hier aber wirklich das schlechteste was man machen kann!!!
Bitte ersetze es einfach durch:
WaitForSingleObject(pi.hProcess, INFINITE);Oder schau Dir das Beispiel nochmals an:
http://msdn.microsoft.com/library/en-us/dllproc/base/creating_processes.asp
-
char *pcPrg = "c:\\Programme\\ISS\\Proventia Desktop\\AgentRemove.exe";
STARTUPINFO si;
PROCESS_INFORMATION pi;ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );CreateProcess( NULL, pcPrg, NULL, NULL, FALSE, 0, NULL, NULL,
&si, &pi );for (;;)
{
if (WaitForSingleObject(pi.hProcess, INFINITE) == WAIT_OBJECT_0)
{
break;
}
}bring so auch nichts!
Ich glaube das tool macht ein child prozess auf. Wie kann man das abfragen`?
-
Ab W2k könntest Du mit "Job Objects" arbeiten...
http://msdn.microsoft.com/library/en-us/dllproc/base/job_objects.asp
Da kannst Du dann eine Liste der Prozesse innerhalb eines "Jobs" abfragen...Ansonsten gibt es AFAIK keine dokumentierte Möglichkeit...
-
kann man nicht einfach abfragen, ob etwas im task manager geöffnet ist?
hast du eine idee`?
-
Ja, kann man... das hab ich Dir in meinem ersten Posting gezeigt... (zumindest ansatzweise)
-
kannst du mir das ein bisschen genauer erklären?
Ich bin in der sache etwas neu.
Danke
-
trivial: Das ist doch trivial. Stell dich nicht so dumm an.
-
tolle Antwort
-
Ausnahmsweise:
#include <windows.h> #include <tchar.h> #include <tlhelp32.h> bool GetProcessFromName(LPCTSTR szProcessName) { HANDLE hProcessSnap; HANDLE hProcess; PROCESSENTRY32 pe32; DWORD dwPriorityClass; // Take a snapshot of all processes in the system. hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0 ); if( hProcessSnap == INVALID_HANDLE_VALUE ) return false; // Set the size of the structure before using it. pe32.dwSize = sizeof(PROCESSENTRY32); // Retrieve information about the first process, // and exit if unsuccessful if( !Process32First(hProcessSnap, &pe32 ) ) { DWORD gle = GetLastError(); CloseHandle( hProcessSnap ); // Must clean up the snapshot object! SetLastError(gle); return false; } // Now walk the snapshot of processes, and // display information about each process in turn do { if (_tcsicmp(pe32.szExeFile, szProcessName) == 0) { CloseHandle( hProcessSnap ); SetLastError(0); return true; } //hProcess = OpenProcess( PROCESS_ALL_ACCESS, FALSE, pe32.th32ProcessID ); } while( Process32Next( hProcessSnap, &pe32 ) ); CloseHandle( hProcessSnap ); return true; } int _tmain() { GetProcessFromName(_T("explorer.exe")); }