How to Repubilsh the user defined datatypes in Atl based application. 
Author Message
 How to Repubilsh the user defined datatypes in Atl based application.

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;

Quote:
}

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



Sat, 10 Jul 2004 22:50:13 GMT  
 How to Repubilsh the user defined datatypes in Atl based application.
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


Quote:
> 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




Sun, 11 Jul 2004 02:48:47 GMT  
 How to Repubilsh the user defined datatypes in Atl based application.
That's importlib - no pound sign in front.
--
With best wishes,
    Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken


Quote:
> 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

- Show quoted text -

Quote:
> > 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




Sun, 11 Jul 2004 03:45:52 GMT  
 How to Repubilsh the user defined datatypes in Atl based application.
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


Quote:
> 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




Sun, 11 Jul 2004 03:51:43 GMT  
 How to Repubilsh the user defined datatypes in Atl based application.
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


Quote:
> 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




Sun, 11 Jul 2004 03:54:35 GMT  
 How to Repubilsh the user defined datatypes in Atl based application.
As Igor pointed out, it should be importlib("Myserverb.tlb"); not import,
nor #importlib. :)

--
Jack


Quote:
> 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

- Show quoted text -

Quote:
> > > 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




Sun, 11 Jul 2004 04:14:58 GMT  
 How to Repubilsh the user defined datatypes in Atl based application.
Thanks a lot Jack and Igor
That's correct I did the same way
as like importlib("stdole32.tlb");
So I typed
importlib("myserverB.tlb");
But I was not suceed


Quote:
> 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




Sun, 11 Jul 2004 04:36:43 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. DCOM Server - With User Defined Datatype - Crashes!

2. How to use a user defined class as base class

3. User defined messages for CDocument based objects

4. User defined Type in ATL

5. Convert C++ (return type int, long, user-define, etc) function into COM/ATL

6. Passing User defined data Type in ATL

7. How To publish user defined data structures in the ATL

8. 30-day free trial - Problem Reporting =?x-user-defined?Q?application=21=A0?=

9. Dynamically Create ATL composite control on MFC based application

10. Using Access 2000 in an ATL COM based application

11. Defining Boolean datatype!

12. Connection points between a VB COM-based and ATL COM-based (NT Service) MTA

 

 
Powered by phpBB® Forum Software