002
30.08.2004, 20:15 Uhr
~bonanza
Gast
|
wie muss ich das denn dann hier einbinden??
C++: |
#include <iostream> #include <windows.h> #include <tlhelp32.h> using namespace std;
typedef BOOL (WINAPI *TH32_PROCESS) (HANDLE hSnapShot, LPPROCESSENTRY32 lppe); static TH32_PROCESS pProcess32First = NULL; static TH32_PROCESS pProcess32Next = NULL;
int main() { PROCESSENTRY32 pe32 = { 0 }; HANDLE hSnapshot = NULL; HINSTANCE hDll = LoadLibrary("kernel32.dll");
pProcess32First=(TH32_PROCESS)GetProcAddress(hDll,"Process32First"); pProcess32Next=(TH32_PROCESS)GetProcAddress(hDll,"Process32Next");
hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0); if (hSnapshot != (HANDLE) -1) { pe32.dwSize = sizeof (PROCESSENTRY32); int proc_cnt=0,thrd_cnt=0;
if (pProcess32First (hSnapshot, &pe32)) { cout<<"Name\t\t\t\tThreads"<<endl<<endl; do { thrd_cnt+=pe32.cntThreads; proc_cnt++;
cout<<" "<<"\t\t\t\t"<<pe32.cntThreads <<"\r"<<pe32.szExeFile<<endl;
} while(pProcess32Next (hSnapshot, &pe32)); }
cout<<endl <<"Threads: "<<thrd_cnt<<endl <<"Prozesse: "<<proc_cnt<<endl;
CloseHandle (hSnapshot); cout << "\n\n Fur weiter eine beliebige Taste drucken und mit Enter bestatigen!!! " << endl; }
cin.get(); int wahl; char starten; cout << " \n\nProzess beenden! (1)" << endl; cout << "\nProzess/Programm starten! (2)" << endl; cout << "\n Ihre Eingabe: " << endl; cin >> wahl; cout << wahl << endl;
//wahl treffen
switch (wahl) { case 1: cout << " Prozess beenden! " << endl; break; case 2: {cout << " Prozess/Programm starten! " << endl; cout << "\n geben sie nun den Pfad an! " << endl; cin >> starten; system ("start ???");} break; default: cout << " FALSCHE EINGABE!!! " << endl; } return 0; unsigned long milliseconds = 30000; Sleep(milliseconds);
}
|
|