
Zitat von
choose:
Ja, genau so geht's

ok, dann schau mal bitte was hier mein Fehler ist:
Delphi-Quellcode:
Function CloseProcWndCB(hWnd :HWND; param :lparam): Boolean; stdcall;
Begin
GetWindowThreadProcessId(hWnd, @dwPID);
if (dwPID = param) Then
begin
PostMessage(hWnd, WM_CLOSE, NULL, NULL);
end;
CloseProcWndCB := true;
End;
Procedure CloseProcessWindows(dwPID :dword);
Begin
EnumWindows(@CloseProcWndCB, dwPID);
End;
Über CloseProcessWindows wird nur die PID übergeben und sollte das Programm dann schliessen, aber es passiert gar nichts. Ich hab sicher was falsch gemacht. Nur was?