Hallo!
Hi erwin,
google doch mal in Groups nach
declare alias findwindow
dann kommst du zu APIs die das können.
Und google auch nach
hwnd Declare alias
Jeder Prozess hat eine Nummer, eben diese hwnd-Nummer mit der
man ihn ansprechen/killen usw. kann.
Gruß
Reinhard
So ist das nicht!
Ein Prozess wird nicht per HWND sondern durch eine ProcessID gekennzeichnet.
Um zu ermitteln welche Prozesse im System laufen kannst du die ToolHelp32 API verwenden.
Anbei mal ein Codeschnippsel der Zeigt wie man die Prozesse Auflistet.
Nun ist es ein leichtes die ProcessID des (warscheinlich per Namen) gesuchten Prozesses zu ermitteln und entsprechend zu reagieren.
CString txt;
HANDLE hProcessSnap = NULL;
PROCESSENTRY32 pe32 = {0};
//create the processlist
nodeStat+="
ROCESSLIST";
//take a snapshot of all processes in the system.
hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hProcessSnap == INVALID_HANDLE_VALUE) continue;
pe32.dwSize = sizeof(PROCESSENTRY32);
//walk the snapshot of the processes, and for each process,collect informations
if (Process32First(hProcessSnap, &pe32))
{
DWORD dwPriorityClass;
MODULEENTRY32 me32 = {0};
do
{
HANDLE hProcess;
// Get the actual priority class.
hProcess = OpenProcess (PROCESS_ALL_ACCESS,
FALSE, pe32.th32ProcessID);
dwPriorityClass = GetPriorityClass (hProcess);
CloseHandle (hProcess);
// process name: szExeFile
txt.Format(":EXEFILE,%s",pe32.szExeFile);nodeStat+=txt;
// process Id
txt.Format(":ID,%d",pe32.th32ProcessID);nodeStat+=txt;
// base priority of any threads
txt.Format("
RICLASSBASE,%d",pe32.pcPriClassBase);nodeStat+=txt;
// number of threads
txt.Format(":CNTTHREADS,%d",pe32.cntThreads);nodeStat+=txt;
/*
// Print the process’s information.
printf( „\nPriority Class Base\t%d\n“,
pe32.pcPriClassBase);
printf( „PID\t\t\t%d\n“, pe32.th32ProcessID);
printf( „Thread Count\t\t%d\n“, pe32.cntThreads);
*/
nodeStat+=":EOP";
}
while (Process32Next(hProcessSnap, &pe32));
}
CloseHandle (hProcessSnap);
Gruß Pauli!
p.s. An den MOD: BITTE das Eingabesteuerelement ersetzen, man kann hier nicht vernünftig Code Posten da Formatierung usw. im a. sind