Solved

How to define a struct data interface in a ActiveX control?

Posted on 2003-11-22
6
454 Views
Last Modified: 2013-11-20
I hope define a struct interface as GetPostInfo(PostInfo* postinfo); in a ActiveX control,

for example this struct as following:
typedef Struct PostInfo
{
   long nIndex;
   BSTR strPostName;
} PostInfo
 
and how to define that parameter of a FUNCTION definition in a xxxctrl.h
DISP_FUNCTION(CxxxCtrl, "GetPostInfo", GetPostInfo, VT_BOOL, ?)

so I must define this PostInfo struct in ODL file, and I hope this interface as a common data type, for example DRAWITEMSTRUCT, the data can be transfer from COM inside to user.
0
Comment
Question by:Gempin
  • 2
6 Comments
 

Author Comment

by:Gempin
ID: 9805610
Experts, help me, please~~
0
 

Author Comment

by:Gempin
ID: 9822893
Experts, help me, please~~
0
 

Accepted Solution

by:
boonsha earned 300 total points
ID: 10070207
We are allowed to declare C and C++ style structures in an IDL file. Once declared they can be used like usual data types. This is show in the following IDL code.

         // declare structure

        typedef struct
        {
            double x ;
            double y ;
        } Point2d ;
       // interface IZ
       [object,uuid (32bb8325-b41b. 11cf-a6bb- 0080c7b2d682);
      helpstring ("IZInterface")
      pointer_default(unique)]
      interface IZ ; IUnknown
      {
                HRESULT StructIn ( [in] Point2d pt ) ;
                HRESULT StructOut ( [out] Point2d *pt ) ;
      } ;

As shown here the StructIn( ) method receives a structure of type Point2d and the method StructOut( ) returns a Point2d structure. Once the structure has been defined in the IDL file there is no need to declare it again in the client program. The client program can easily pass and receive this structure without the declaration. This is possible because when we #import the server’s type library file the structure declaration also gets imported.

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Decoding 32 bit binary streams 6 54
Turn a spreadsheet into a vba executable. 2 98
method notes when mouse over in eclipse 5 90
unix example issues 18 106
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question