> As Igor pointed out, it should be importlib("Myserverb.tlb"); not import,
> nor #importlib. :)
> --
> Jack
> > Thanks Jack
> > Now I am redefined new set of similar enums in another header file and
> > import IDL and type casting the type.its works
> > I tried your solution 1: I copy the serverB tlb file to my project
> directory
> > and import in the lib
> > library MTS1780TESTCONTROLLERLib
> > {
> > importlib("stdole32.tlb");
> > importlib("stdole2.tlb");
> > import("MyserverB.tlb"
> > [
> > uuid(CDC41CA5-052F-11D6-A85B-0050DA668F28),
> > helpstring("_ITestMacroInterfaceEvents Interface")
> > ]
> > I compile it. But the enums are not published. When I refer the enum to
> the
> > function I am compile error undefined type
> > Am I doing correct ?
> > please help me out
> > Thanks
> > Ravi
> > > Solution 1:
> > > Put #importlib("MyServerB.tlb"); within your library block of .idl
file,
> > and
> > > put your interface declaration under it.
> > > Solution 2:
> > > Put your enum declaration into a separate .idl file, import it in both
> > > ServerA and ServerB.
> > > Jack
> > > > Hello every one
> > > > I am building an atl based activeX server (say MyServerA dll using
> VC++.
> > > > with in the server I want to use another component which is a atl
> based
> > > > activeX server too( say MyServerB).
> > > > MyServerB has published user defined enums. which is used as
MyserverB
> > > > function arguments.
> > > > I use smart pointers and #Import directive to access the MyServerB
> > > publised
> > > > objects. I have n oproblem of calling MyserverB object's methods and
> > > > properties with in the MyServerA.
> > > > eg: Code for creating Com Object in MyServerA CMyClass
> > > > #import "MyServerB.tlb"no_namespace
> > > > Smart pointer
> > > > -----------
> > > > IClass1Ptr m_spobjectClass1
> > > > #define CREATEiNSTANCE(sp,riid) { HRESULT _hr =sp
> > > > reateInstance( __uuidof( riid ) ); \
> > > > if (FAILED(_hr)) _com_issue_error(_hr);
> > > > CREATEiNSTANCE(m_spobjectClass1,Class1);
> > > > Now I want to create a wrapper function at Myserver A for My serverB
> > which
> > > > is using publied user defined enum
> > > > For Example MyServerB
> > > > MyServerB.Class1.Function1( Settings udtsettings); Where Settings
is
> a
> > > > user defined enum.
> > > > Now I want to create a wrapper function in MyServerA. I get an MIDL
> > Error
> > > > for Unknown user defined type
> > > > My idl declaration similair to
> > > > [id(1), helpstring("method MyFunction")] HRESULT
> MyFunction([in]Settings
> > > > mySettings)
> > > > Implementation side
> > > > STDMETHODIMP CMyClass::StartTestSequence(Settings mySettings)
> > > > {
> > > > AFX_MANAGE_STATE(AfxGetStaticModuleState())
> > > > *result= m_spobjectClass1.Function1(mySettings)
> > > > return S_OK;
> > > > }
> > > > To over come this problem I know If I publish Different user define
> enum
> > > for
> > > > Settings ( eg called as TestSettings) and
> > > > Do a type casting (or re mapping )at MyServerA.
> > > > Is there are any other way I could implement this. Please help me
out
> > > > Thanks in advance
> > > > --
> > > > Ravi .T. Ravigulan
> > > > R&D Software Developer
> > > > Manta Test Systems
> > > > 4060B Sladeview Crescent, Unit#1
> > > > Mississauga, ON L5L 5Y5
> > > > Tel: 905-828-6469 x260
> > > > Fax: 905-828-6850
> > > > www.mantatest.com