How do I use class that inherit from ICallback

I want to get the information of tiles download. I think I should write a new class that inherits the ICallback class and override the virtual function : Progress(_bstr_t KeyOfSender,long Percent, _bstr_t Message), then calling the putGlobalCallback () function to set the callback.however, all objects are created using smart COM Pointers,like this :
ICallbackPtr m_pCallback;
So ,I cannot create an inherited class. Is there any good way to do it?

Hello @zcwbnu

Bear with me, I’m not sure I understand your context.

I’m guessing that you want to inherit ICallback outside of the OCX, in your own code (c# or c++)? Since if you were coding within the OCX, you can change whatever you need to…

But outside of the OCX, I’m not sure you can get any additional information, since the built-in callback will only pass you what it knows, and it doesn’t know anything about a subclass or secondary interface.

Then again, if you create an interface (e.g. IMyCallback), and have an implementation class that implements both ICallback and IMyCallback, then I think you should be able to pass that class into the putGlobalCallback, since it merely has to satisfy the ICallback type-checking. And when the callback is made from the OCX, you can do additional things internal to your class, and it will be handing you back your subclassed ICallback implementation. When you get it back, you can QI to your custom interface and get the additional information you want.

Does that make sense, or am I completely missing the boat on your question.


I just want to get the progress of downloading tiles through Callback.I’m using C ++, I don’t know how to get progress.
In this example, firstly, inherit the ICallback class and override the Progress function,then get parameter “Percent”.

In c++ it would be very similar to c#. Something like:

class Callback : ICallback
	HRESULT STDMETHODCALLTYPE Progress(BSTR KeyOfSender, long Percent, BSTR Message)
        // do something with the Percent value

Is this what you’re looking for?

But this object cannot be built. Do I have to rewrite all the functions?