Marco Cantù 1998, Mastering Delphi 4

Project: ONECOPY.DPR


Project Structure


ONECOPY.DPR

program OneCopy;

uses
  Forms, Windows,
  OneF in 'OneF.pas' {Form1};

{$R *.RES}

var
  hMutex: THandle;

begin
  HMutex := CreateMutex (nil, False, 'OneCopyMutex');
  if WaitForSingleObject (hMutex, 0) <> wait_TimeOut then
  begin
    Application.Initialize;
    Application.CreateForm(TForm1, Form1);
    Application.Run;
  end;
end.

ONEF.PAS

unit OneF;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}


end.

ONEF.DFM

object Form1: TForm1
  Left = 241
  Top = 125
  Width = 250
  Height = 108
  Caption = 'OneCopy'
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 7
    Top = 8
    Width = 218
    Height = 54
    Alignment = taCenter
    Caption = 'Run a second copy of this application'
    Font.Color = clWindowText
    Font.Height = -24
    Font.Name = 'Arial'
    Font.Style = []
    ParentFont = False
    WordWrap = True
  end
end


Copyright Marco Cantù 1998