Identifying Open Inspectors

Add-in Express™ Support Service
That's what is more important than anything else

Identifying Open Inspectors
 
Mark Stevens




Posts: 36
Joined: 2014-09-15
For the purpose of identifying a particular open Inspector, is it safe to use the address of the object?

It seems to work but I have no idea if the address could change for any reason.

Or is there another way of uniquely identifying an Inspector?

Thanks

Mark
Posted 21 Nov, 2018 06:35:22 Top
Andrei Smolin


Add-in Express team


Posts: 16334
Joined: 2006-05-11
Hello Mark,

We also suppose this may not work but we've never got a confirmation of our doubts. So, we assume it should work.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 21 Nov, 2018 06:50:38 Top
Mark Stevens




Posts: 36
Joined: 2014-09-15
Hi Andrei

Thanks for that. You don't know of any other way of uniquely identifying an Inspector?

Regards

Mark
Posted 21 Nov, 2018 07:15:29 Top
Mark Stevens




Posts: 36
Joined: 2014-09-15
I'm trying out using the Inspector address as an ID and it's fine except for the OLInspectorActivate event. I assume I would have to pick it up from within the TInspector(Sender) using the private field FIntF?

I tried using a hack with TInspector to pick up the address from FIntF (which has the correct address when viewed in the debugger). However, my code gives me something else?


  THackInspector = class(TInspector)
  public
    FIntf: _Inspector;
  end;
...
      iID := DWORD(THackInspector(Sender).FIntf);

I modified adxAddIn to make the variable public and it's fine. I assume it's something to do with the hack?

Any ideas?

Thanks

Mark
Posted 21 Nov, 2018 11:50:44 Top
Andrei Smolin


Add-in Express team


Posts: 16334
Joined: 2006-05-11
Mark,

procedure TAddInModule.adxCOMAddInModuleOLInspectorActivate(Sender: TObject);
var insp: _Inspector;
begin
  insp := (Sender as TInspector).DefaultInterface;
end;


Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 22 Nov, 2018 06:54:05 Top
Mark Stevens




Posts: 36
Joined: 2014-09-15
Many thanks Andrei

That's a much better solution.

Regards

Mark
Posted 22 Nov, 2018 08:24:55 Top
Andrei Smolin


Add-in Express team


Posts: 16334
Joined: 2006-05-11
You are welcome!

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 22 Nov, 2018 08:34:13 Top