Solved

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

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Error on moodle after upgrade 3 140
Unix / Linux grid computing 5 162
Dell Alienware Graphics Amplifier Driver for non-Alienware systems 18 338
Way to decrease size of apk file 9 86
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.

809 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