Jump to content
Sign in to follow this  
Ian Branch

Help with TurboPower OnGurad..

Recommended Posts

Hi Team,

Not sure if this is the right place for this query.  Somebody correct me please if its not.

Installed OnGuard into D10.3.1.  All good.

Now building all the Demos/Examples to make sure everything is as it should be.

Most of them there is no issue however on 3 of them I have the same issue.

I will use the EXInst example for this query.

When I tried to build the example I got the message it couldn't find the IsFirstInstance function.

Snooping, I found that ogFirst is now vcl.ogfirst, so I changed the uses to vcl.ogfirst.

Hmmm  Same error. 😞  vcl.ogfirst is definately there.  The following is the code in exinst..

program Exinst;

uses
  Forms,
  vcl.ogfirst,
  ExInstU in 'EXINSTU.PAS' {FirstInstFrm};


begin
  Application.Title := 'Single Instance Example';

  if IsFirstInstance then begin
    Application.CreateForm(TFirstInstFrm, FirstInstFrm);
    Application.Run;
  end else
    ActivateFirstInstance;
end.

In vcl.ogfirst there is the following..

...

...

{detect/Activate instance routines}
type
  TogFirst = record
  private class var
    FFirstInstance : Boolean;
    FInstanceMutex : THandle;
  private
    class function GetMutexName: string; static;
  public
    class function IsFirstInstance: Boolean; static;
    class procedure ActivateFirstInstance; static;
  end;

...

...

What have I missed please?

 

Regards & TIA,

Ian

 

 

Edited by Sherlock
inserted correct code tags

Share this post


Link to post

I've never used that before, but to me it looks pretty clear, that IsFirstInstance is not a stand-alone function but a class function of TogFirst. So when you want to use it, you must use it through its class (or in this case record):

if TogFirst.IsFirstInstance then
begin
 ShowMessage('Yay!');
end;

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×