Thema: Delphi Task überprüfen

Einzelnen Beitrag anzeigen

Pump3r

Registriert seit: 6. Okt 2005
175 Beiträge
 
Delphi 7 Enterprise
 
#3

Re: Task überprüfen

  Alt 19. Jun 2006, 09:05
Delphi-Quellcode:
unit test;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ShellAPI;

type
  TForm1 = class(TForm)
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation
var
H : THandle;

{$R *.dfm}

initialization
  H := CreateMutex(nil, True, 'Opera.exe');
  if GetLastError = ERROR_ALREADY_EXISTS then
    begin
      MessageDlg('Opera'
       +#13+#13+'das Programm ist bereits aktiv.',
       mtInformation, [mbOk], 0);
      Halt;
    end;

finalization
  if H <> 0 then
    begin
      CloseHandle(H);
  end;

end.

dat will nicht so wie ich will
Christian Hermann
  Mit Zitat antworten Zitat