转贴:
How do I pass a structure to a method in an IDL file?
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.