May 12th, 1999, 04:35 AM
I have added a event to a simple object in MFC projectg by using
BEGIN_CONNECTION_PART and other macros.
(I don't want to use ATL to do this.)
//.H
BEGIN_CONNECTION_PART(CEx24bAuto, SampleConnPt)
CONNECTION_IID(xIID_ISampleSink)
END_CONNECTION_PART(SampleConnPt)
DECLARE_CONNECTION_MAP()
//.Cpp
BEGIN_CONNECTION_MAP(CEx24bAuto, CCmdTarget)
CONNECTION_PART(CEx24bAuto, IID_ISampleSink, SampleConnPt)
END_CONNECTION_MAP()
//.ODL
[
object,
uuid(532191AE-0932-11D3-889D-00A0C9C67961),
pointer_default(unique)
]
interface _CIEx24bAuto: IUnknown
{
//HRESULT OnEventFired() ;
};
[ uuid(A9515AD8-5B85-11D0-848F-00400526305B) ]
coclass Ex24bAuto
{
[default] dispinterface IEx24bAuto;
[source] interface _CIEx24bAuto;
};
When use this object in VB program as following:
Dim WithEvents xobj As Ex24b.Ex24bAuto
Private Sub Form_Load()
Set xobj = New Ex24b.Ex24bAuto '(Error 430)
End Sub
An error will occur. The error message is "Class doesn't
support Automation (Error 430)". If "WithEvents" removed,
It works correctly.
Any advice will be appreciated.
BEGIN_CONNECTION_PART and other macros.
(I don't want to use ATL to do this.)
//.H
BEGIN_CONNECTION_PART(CEx24bAuto, SampleConnPt)
CONNECTION_IID(xIID_ISampleSink)
END_CONNECTION_PART(SampleConnPt)
DECLARE_CONNECTION_MAP()
//.Cpp
BEGIN_CONNECTION_MAP(CEx24bAuto, CCmdTarget)
CONNECTION_PART(CEx24bAuto, IID_ISampleSink, SampleConnPt)
END_CONNECTION_MAP()
//.ODL
[
object,
uuid(532191AE-0932-11D3-889D-00A0C9C67961),
pointer_default(unique)
]
interface _CIEx24bAuto: IUnknown
{
//HRESULT OnEventFired() ;
};
[ uuid(A9515AD8-5B85-11D0-848F-00400526305B) ]
coclass Ex24bAuto
{
[default] dispinterface IEx24bAuto;
[source] interface _CIEx24bAuto;
};
When use this object in VB program as following:
Dim WithEvents xobj As Ex24b.Ex24bAuto
Private Sub Form_Load()
Set xobj = New Ex24b.Ex24bAuto '(Error 430)
End Sub
An error will occur. The error message is "Class doesn't
support Automation (Error 430)". If "WithEvents" removed,
It works correctly.
Any advice will be appreciated.