Download Now

    Reference TUniqueInstance

    Declared in Codebot.Unique.pas on line 32

    TUniqueInstance detects if another instance of a program is already running by listening on a local port. The original instance receives messages sent by later instances.
      TUniqueInstance = class
      public
        { Create a unique instance listening on the port given by Key }
        constructor Create(Key: Word);
        destructor Destroy; override;
        { Send a message to the original instance }
        procedure SendMessage(const Message: string);
        { Original is true if this is the first running instance }
        property Original: Boolean read FOriginal;
        { OnMessage is invoked on the main thread when the original instance
          receives a message }
        property OnMessage: TMessageEvent read FOnMessage write FOnMessage;
      end;

    See also