Re: VB Activex control with a window in a ATL project
You are getting the following error:
CONNECT_E_NOCONNECTION
This connectable object does not support the outgoing interface specified by
riid.
#define CONNECT_E_NOCONNECTION (CONNECT_E_FIRST+0)
// there is no connection for this connection id
E.g. your ActiveX Control complains that it doesn't support
the events for DIID__IGEvents. Check if the GUID is correct.
The error code is returned by IConnectionPointContainer::
FindConnectionPoint
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@mvps.org
MVP VC FAQ: http://vcfaq.mvps.org
=====================================
"vijay" <vijay116@gmail.com> wrote in message
news:1173893423.829731.137680@y80g2000hsf.googlegroups.com...
Hi,
Thanks for the reply...I followed your other extensive posts about ATL
hosting with a window.(for activex control)
I was able to solve this problem..almost.
Just one more problem with receiving events from VB activex in the
ATL..
Trying to use DispEventAdvise SINK_ENTRY_INFO...any pointers?
Is this the right way to receive events in ATL from VB activex?
---------------------------------------------------------------------------------------------------------------------------
static _ATL_FUNC_INFO OnPBFrameInfo = {CC_STDCALL, VT_EMPTY, 3,
{VT_DATE, VT_I2, VT_I2}};
static _ATL_FUNC_INFO OnPBErrorInfo = {CC_STDCALL, VT_EMPTY, 2,
{VT_I2, VT_BSTR}};
static _ATL_FUNC_INFO OnPBCreateWInfo = {CC_STDCALL, VT_EMPTY,
VT_NULL};
static _ATL_FUNC_INFO OnPBStateInfo = {CC_STDCALL, VT_EMPTY, 1,
{VT_I2}};
class CPBEventSink : public IDispEventImpl<IDC_PBOBJ, CPBEventSink,
&::DIID__IGEvents>
{
public:
//CPBEventSink(CDVRUnitConnection* conn):m_pConn(conn){};
CPBEventSink()
{
}
BEGIN_SINK_MAP(CPBEventSink)
//Make sure the Event Handlers have __stdcall calling convention
SINK_ENTRY_INFO(IDC_PBOBJ, DIID__IGEvents, 0x1, pbFrameNotify,
&OnPBFrameInfo)
SINK_ENTRY_INFO(IDC_PBOBJ, DIID__IGEvents, 0x6, pbErrorNotify,
&OnPBErrorInfo)
SINK_ENTRY_INFO(IDC_PBOBJ, DIID__IGEvents, 0x4, pbCreateWindow,
&OnPBCreateWInfo)
SINK_ENTRY_INFO(IDC_PBOBJ, DIID__IGEvents, 0x14, pbStateChange,
&OnPBStateInfo)
END_SINK_MAP()
void __stdcall pbFrameNotify(DATE dateFrameTime,
int nMotionPercentage,
int nBuffering )
{
TCHAR buf[80];
wsprintf(buf, "FRAME PB Notification Event Received");
AtlTrace("\n%s",buf);
}
// Event Handler
void __stdcall pbErrorNotify(int nErrorCode,
BSTR bstrError )
{
TCHAR buf[80];
wsprintf(buf, "ERROR PB Notification Event Received");
AtlTrace("\n%s",buf);
}
void __stdcall pbCreateWindow()
{
TCHAR buf[80];
wsprintf(buf, "ERROR PB Notification Event Received");
AtlTrace("\n%s",buf);
}
void __stdcall pbStateChange(int state)
{
TCHAR buf[80];
wsprintf(buf, "ERROR PB Notification Event Received");
AtlTrace("\n%s",buf);
}
};
-----------------------------------------------------------------------------------------------------------------------------------------------------------
and calling DispEventAdvise like this
m_PBSink=new CPBEventSink();
hr = m_PBSink->DispEventAdvise(pUnkCtrl, &(::DIID__IGEvents));
Where pUnkCtrl is the pointer to the unknown control..
here I receive hr as "0x80040200"
Thanks
Vijay