procedure TForm1.FormCreate(Sender: TObject); begin { Searchs table to see if the program is already running } if GlobalFindAtom('PROGRAM_RUNNING') = 0 then { If not found then add it } fAtom := GlobalAddAtom('PROGRAM_RUNNING') else begin { If program is already running the show message and halt } MessageDlg('Programmet er startet',mtWarning, [mbOK], 0); // Halt; end;end;
procedure TForm1.FormDestroy(Sender: TObject); begin GlobalDeleteAtom(fAtom); end;
type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form1: TForm1; fAtom : TAtom;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject); begin begin { Searchs table to see if the program is already running } if GlobalFindAtom('PROGRAM_RUNNING') = 0 then { If not found then add it } fAtom := GlobalAddAtom('PROGRAM_RUNNING') else begin { If program is already running the show message and halt } MessageDlg('Programmet er startet',mtWarning, [mbOK], 0); Halt; end; end;
end;
procedure TForm1.FormDestroy(Sender: TObject); begin GlobalDeleteAtom(fAtom);
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.