Ian Branch 127 Posted February 27, 2019 (edited) 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 February 27, 2019 by Sherlock inserted correct code tags Share this post Link to post
Sherlock 663 Posted February 27, 2019 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
Ian Branch 127 Posted February 27, 2019 Ah Ha! Thanks Sherlock. Appreciated. All good now. Regards, Ian Share this post Link to post