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;
struct __declspec(uuid("9e7f7f6c-7119-4b74-958b-ca9a6680b6b6"))
/* dispinterface */ IMyControl;
struct __declspec(uuid("af804d11-3361-46bb-8173-4ca5f0eda476"))
/* dispinterface */ IMyControlEvents;
struct /* coclass */ MyControl;
To copy to clipboard, switch view to plain text mode
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 (
HRESULT signalTest ( );
};
struct __declspec(uuid("af804d11-3361-46bb-8173-5ca9f0eda476"))
IMyControlEvents: IDispatch
{
// Methods:
HRESULT destroyed_1 ( );
HRESULT customContextMenuRequested (
struct QPoint p_pos );
HRESULT signalTest ( );
};
To copy to clipboard, switch view to plain text mode
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);
};
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);
};
To copy to clipboard, switch view to plain text mode
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
Bookmarks