Autor Beitrag
raiha
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 152



BeitragVerfasst: Di 23.05.06 11:55 
Hi,

wie kann ich beim Start eines Proggis prüfen, ob schon eine Inzanz von Ihm läuft und wenn ja, diese gleich beenden.

Danke Rainer
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Di 23.05.06 12:01 

_________________
There are 10 types of people - those who understand binary and those who don´t.
Crowbar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 180

WinXP, SP2
D6 Enterprise
BeitragVerfasst: Di 23.05.06 12:26 
Hi,
ich habe es so gelöst:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
...
Initialization
{ Verhindern, daß das Programm mehrfach gestartet wird! }
   mHandle:=CreateMutex(nil,true,'Programmname');
   if GetLastError=ERROR_ALREADY_EXISTS then
    begin
      MessageDlg('Das Programm ist bereits gestartet !',mtInformation,[mbOk],0);
      Halt;
     end;
 Finalization
   if mHandle <> 0 then CloseHandle(mHandle)
...
End.

Diesen Code habe ich am Ende meiner HauptForm gesetzt.
Hierbei wird eine Meldung ausgegeben, dass das Programm bereits gestartet ist und somit startet es nicht erneut.

Crowbar