PDA

View Full Version : Listening events of a QAxServer module



juan
12th November 2006, 18:43
Hello,

It's nice to be in this cool place :) I hope I can help any of you sometimes..

If this question is out of the scope of this section, just ignore or remove it.

I have done an Active X control (using QAXFACTORY_DEFAULT macro) that I need to load in a host client which is an app done in VC++6. The control loads fine inside the host app and I can set/get the properties I have exposed. My only problem is that I have not found a way to achieve that the host client listens the events of the Ax server.

Looking into the tlh file generated by QT, it defines this interfaces:

struct __declspec(uuid("9e7f7f6c-7119-4b74-958b-ca9a6680b6b6"))
/* dispinterface */ IMyControl;
struct __declspec(uuid("af804d11-3361-46bb-8173-4ca5f0eda476"))
/* dispinterface */ IMyControlEvents;
struct /* coclass */ MyControl;

And the events interface exposes the only signal I have defined ( signalTest ):


struct __declspec(uuid("af804d11-3361-46bb-8173-5ca9f0eda476"))
IMyControlEvents: IDispatch
{
// Methods:
HRESULT destroyed_1 ( );
HRESULT customContextMenuRequested (
struct QPoint p_pos );
HRESULT signalTest ( );
};

So everything looks fine, now I just need the host app knows when this control notifies an event. I have searched a lot and it seems I have to implement a class in the client that inherits from the events interface of the AxServer.

Something like:


class ATL_NO_VTABLE CMyControlEvents :
public IDispatchImpl<IMyControlEvents, &__uuidof(IMyControlEvents), &__uuidof(__MyControlLib)>
{
public:
CMyControlEvents ()
{
}
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
return S_OK;
}
void FinalRelease()
{
}
STDMETHOD(OnSignalTest)(void);
};

But actually I have not experience at all in this field ATL-COM and I am completely lost.
I am using Qt 4.2.1 full licensed, perhaps this forum is only for questions about the free edition; if so, please sorry and remove it.

Many thanks for your help :)

Juan

illebille
5th February 2008, 14:59
Hi,

I would like to know if a solution was found to this problem, because I'm stuck on a similar problem myself, and I don't seem to get out.

Thanx