How To publish user defined data structures in the ATL 
Author Message
 How To publish user defined data structures in the ATL

Hello every one
I need to publish my own data structures in the type lib. I was sucessfull
in publishing enums from ATL. so that from VB client can use the enums

I defined enums  in a header file and import in the IDL Defintion
In IDL Defintion
import "TestControllerTypedef.h";

I define the enums in the header file like
eg.
typedef enum
{
 TST_EV_TEST_COMPLETED,
 TST_EV_SHOW_TARGET_PKUP_DLG,
 TST_EV_SHOW_TARGET_RST_DLG

Quote:
} TTestEvent;

From VB clinet application (Press F2) I can see the TTestEvent as an Enum.
Now I want to publish my own structure too in the same way
eg:
typedef struct
{
    float param1;
    int  param2;
   BSTR param3;

Quote:
} MyType;

I can compile but I don't see the MyType from VB. (If I build a automation
server from VB and If I define a type in the classs so I could see the type
from the client app.)

Where I am wrong.
If any body knows how to publish the user define structure from VC++ ATL
model Pls help me out.

Thanks in Advance

Ravi

Quote:
}



Wed, 14 Apr 2004 01:25:38 GMT  
 How To publish user defined data structures in the ATL
See "HOWTO: Use structs in Automation-compatible interfaces" at

http://www.mvps.org/vcfaq/com/4.htm

--
With best wishes,
    Igor Tandetnik

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


Quote:
> Hello every one
> I need to publish my own data structures in the type lib. I was sucessfull
> in publishing enums from ATL. so that from VB client can use the enums

> I defined enums  in a header file and import in the IDL Defintion
> In IDL Defintion
> import "TestControllerTypedef.h";

> I define the enums in the header file like
> eg.
> typedef enum
> {
>  TST_EV_TEST_COMPLETED,
>  TST_EV_SHOW_TARGET_PKUP_DLG,
>  TST_EV_SHOW_TARGET_RST_DLG
> } TTestEvent;

> From VB clinet application (Press F2) I can see the TTestEvent as an Enum.
> Now I want to publish my own structure too in the same way
> eg:
> typedef struct
> {
>     float param1;
>     int  param2;
>    BSTR param3;
> } MyType;

> I can compile but I don't see the MyType from VB. (If I build a automation
> server from VB and If I define a type in the classs so I could see the
type
> from the client app.)

> Where I am wrong.
> If any body knows how to publish the user define structure from VC++ ATL
> model Pls help me out.

> Thanks in Advance

> Ravi

> }



Wed, 14 Apr 2004 01:33:50 GMT  
 How To publish user defined data structures in the ATL
Thanks Igor

I tried the same sample code shown in the document I am getting compliation
error MIDL2072 :inapplicable attribute : [uuid] [ Struct 'MyStruct'  ]
I don't know why

What I did
I defined the structure in a header file
[uuid(230B3A60-CA43-11d5-A815-0050DA668F28)]
struct MyStruct
 {
    [helpstring("A long value")]
    long nLongValue;
    [helpstring("A string")]
    BSTR bstrStringValue;
    };

declared in the IDL

library MTS1780TESTCONTROLLERLib
{
    struct MyStruct

Quote:
};



Quote:
> See "HOWTO: Use structs in Automation-compatible interfaces" at

> http://www.mvps.org/vcfaq/com/4.htm

> --
> With best wishes,
>     Igor Tandetnik

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



> > Hello every one
> > I need to publish my own data structures in the type lib. I was
sucessfull
> > in publishing enums from ATL. so that from VB client can use the enums

> > I defined enums  in a header file and import in the IDL Defintion
> > In IDL Defintion
> > import "TestControllerTypedef.h";

> > I define the enums in the header file like
> > eg.
> > typedef enum
> > {
> >  TST_EV_TEST_COMPLETED,
> >  TST_EV_SHOW_TARGET_PKUP_DLG,
> >  TST_EV_SHOW_TARGET_RST_DLG
> > } TTestEvent;

> > From VB clinet application (Press F2) I can see the TTestEvent as an
Enum.
> > Now I want to publish my own structure too in the same way
> > eg:
> > typedef struct
> > {
> >     float param1;
> >     int  param2;
> >    BSTR param3;
> > } MyType;

> > I can compile but I don't see the MyType from VB. (If I build a
automation
> > server from VB and If I define a type in the classs so I could see the
> type
> > from the client app.)

> > Where I am wrong.
> > If any body knows how to publish the user define structure from VC++ ATL
> > model Pls help me out.

> > Thanks in Advance

> > Ravi

> > }



Wed, 14 Apr 2004 03:11:05 GMT  
 How To publish user defined data structures in the ATL
You don't have the new MIDL compiler coming with the Platform SDK
(or your executable directories don't list the Platform SDK \BIN directory
before that of VC). Check your directories in Tools/Options/Directories
and the Executables page. The article explicitly states you need newer
MIDL.EXE.

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD

MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================


Quote:
> Thanks Igor

> I tried the same sample code shown in the document I am getting
compliation
> error MIDL2072 :inapplicable attribute : [uuid] [ Struct 'MyStruct'  ]
> I don't know why

> What I did
> I defined the structure in a header file
> [uuid(230B3A60-CA43-11d5-A815-0050DA668F28)]
> struct MyStruct
>  {
>     [helpstring("A long value")]
>     long nLongValue;
>     [helpstring("A string")]
>     BSTR bstrStringValue;
>     };

> declared in the IDL

> library MTS1780TESTCONTROLLERLib
> {
>     struct MyStruct
> };



> > See "HOWTO: Use structs in Automation-compatible interfaces" at

> > http://www.mvps.org/vcfaq/com/4.htm

> > --
> > With best wishes,
> >     Igor Tandetnik

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



> > > Hello every one
> > > I need to publish my own data structures in the type lib. I was
> sucessfull
> > > in publishing enums from ATL. so that from VB client can use the enums

> > > I defined enums  in a header file and import in the IDL Defintion
> > > In IDL Defintion
> > > import "TestControllerTypedef.h";

> > > I define the enums in the header file like
> > > eg.
> > > typedef enum
> > > {
> > >  TST_EV_TEST_COMPLETED,
> > >  TST_EV_SHOW_TARGET_PKUP_DLG,
> > >  TST_EV_SHOW_TARGET_RST_DLG
> > > } TTestEvent;

> > > From VB clinet application (Press F2) I can see the TTestEvent as an
> Enum.
> > > Now I want to publish my own structure too in the same way
> > > eg:
> > > typedef struct
> > > {
> > >     float param1;
> > >     int  param2;
> > >    BSTR param3;
> > > } MyType;

> > > I can compile but I don't see the MyType from VB. (If I build a
> automation
> > > server from VB and If I define a type in the classs so I could see the
> > type
> > > from the client app.)

> > > Where I am wrong.
> > > If any body knows how to publish the user define structure from VC++
ATL
> > > model Pls help me out.

> > > Thanks in Advance

> > > Ravi

> > > }



Wed, 14 Apr 2004 09:38:28 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Passing User defined data Type in ATL

2. Passing user defined structures from VB to C++ DLL

3. User defined Type in ATL

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

5. Publishing user define enums in ATL server any limitations ?

6. HOWTO: Display user defined data in watch window

7. User Defined Data Types and Pointers

8. HELP! user-defined data types

9. Returning user defined data types

10. Can't Send User Defined Data Through a Connection Point

11. User defined Message with additional data?

12. multiple users of one data structure

 

 
Powered by phpBB® Forum Software