Click here to Skip to main content
15,880,651 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I have a project that is a com dll plugin to a host application.
The maker of the host application lets us get pointers to various data stucts
such as the UIContext structure like this.

C++
ISonarUIContext3*		m_pSonarUIContext3;


From which I can get the current UI Context running in the Host app:
C++
m_pSonarUIContext3->GetUIContextEx( SurfaceIDs[0], &uiContainer );


Cool.

But I need to now check the UI context from a hook proc.

So I tried to use a static instance of my plugin class as I do with variables.
C++
StaticCBCRMaster->m_pSonarUIContext3->GetUIContextEx( SurfaceIDs[0], &uiContainer );


Which compiles, but can't link because the stuct in the host app is protected and not static.

I'm not going to be able to ever call GetUIContextEx() from a hook proc am I.

:Ron
Posted
Updated 18-Mar-15 12:42pm
v2
Comments
BacchusBeale 18-Mar-15 17:19pm    
If the class you want to call has protected members, maybe you could make a subclass of that class which will give you access?
Ron Anders 18-Mar-15 17:43pm    
Ya lost me. :-)

I have a method provided in the host binary called GetUIContextEx() that is protected (This is what the linker says when I tried to call it directly).

I don't know the class name and am not privied to it.

:Ron
barneyman 18-Mar-15 18:04pm    
it's a COM itf, so can't you just AddRef to the interface from your hook proc, #importing the TLB?

1 solution

I found a work around:

Instead of doing the work in the hook proc, I just set a flag to do the work so when a 75 ms refresh timer calls my code I check the flag and do the work where I have unfettered access to the function.

It seems to be working - needs lots of testing.

Sorry to be a bother again and thanks to all who replied.

:Ron
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900