Solved

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

Posted on 2003-11-22
6
441 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
not able to insert into temp table 68 156
modThree challenge 4 76
MaxSpan challenge 9 79
mapAB Challlenge 35 123
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…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

914 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now