|
program
Project1;
uses
Forms,
Dialogs,
windows,
Unit1 in 'Unit1.pas' {FMain};
{$R *.RES}
begin
SetLastError(NO_ERROR);
CreateMutex(nil,False,'OIM');
if GetLastError<>ERROR_ALREADY_EXISTS then
begin
Application.Initialize;
Application.Title := 'OneInstance APP';
Application.CreateForm(TFMain,FMain);
Application.Run;
end else ShowMEssage('Application Already Running !');
end. |
|
unit
Unit1;
interface
uses
Windows,Messages,SysUtils,Classes,Graphics,Controls,Forms,Dialogs,StdCtrls,ShellApi;
type
TFMain=class(TForm)
LbLink:TLabel;
Label1: TLabel;
procedure LbLinkClick(Sender:TObject);
private
public
end;
var
FMain:TFMain;
implementation
{$R *.DFM}
procedure TFMain.LbLinkClick(Sender:TObject);
begin
ShellExecute(Handle,'open',PChar(LbLink.Caption),nil,nil,1);
end;
end. |