Forum: Win32/Win64 API (native code)
Delphi
by HeikoAdams,
8. Mär 2011
Guckst Du da: http://www.delphipraxis.net/1086701-post7.html
Eventuell schlag ich den Code heute Nachmittag oder Abend für die CodeLib vor ;-)
Forum: Win32/Win64 API (native code)
Delphi
by HeikoAdams,
8. Mär 2011
Aber eine Instanz ist ja immer da - nämlich die, die nach den "toten" Instanzen sucht ;-)
Edit:
Hast Recht: until h = 0; ist besser ;-)
Forum: Win32/Win64 API (native code)
Delphi
by HeikoAdams,
8. Mär 2011
Nein, weil der Code ja normalerweise mindestens die Instanz, die den Code ausführt, finden sollte :gruebel:
Habs ergänzt
Forum: Win32/Win64 API (native code)
Delphi
by HeikoAdams,
8. Mär 2011
Okay, dann würde die entsprechende Code-Sequenz wohl so aussehen:
repeat
h := FindWindowEx(0, h, 'TApplication', PChar(Application.Title));
if (h <> 0)
and (h <> Application.Handle) then
begin
//prüfen, ob die Instanz hängt
Forum: Win32/Win64 API (native code)
Delphi
by HeikoAdams,
7. Mär 2011
Hat sich erledigt. Ich habe eine Lösung gefunden:
function TFrmBackup.CheckInstance: Boolean;
var
h: HWnd;
RetValue: Cardinal;
hProcess, ProcessId: THandle;
begin
Result := True;
Forum: Win32/Win64 API (native code)
Delphi
by HeikoAdams,
7. Mär 2011
Hallo,
hat hier jemand eine Idee, wie ich "tote" Instanzen (z.B. nach einem Programmabsturz) meines Programms finden und beenden kann? Eine Suche zu dem Thema bringt nur die Diskussionen, ob Delphi tot ist oder nicht, als Ergebnisse 8-)