转贴:
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.
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.
解决方案 »
- VC2010 MSCOMM组件 getvalue失败
- 为什么设置了消息响应函数,工具栏的按钮还是灰色的?
- 一个循环绑定同一个端口的问题,急求解,谢谢!!!!!!!!!!!!!!!!!!1
- 正则表达式问题?"<head>Contents</head>“ 中 如何用正则只取得"Contents" ?
- 对于VC没有实战经验,初学者,请出点简单题目……
- 怎么把在CString变量中的一段字符串插入到Edit控件中,Edit控件中已存在字符?
- 老大门,如何编写从outlook导出通讯薄信息的代码
- 哪有DES加密算法的源代码
- 怎么绘制一个bmp图并且在上面添加指定文字呢?
- 关于Win32帮助的制作
- 有没有做gis的高手,近来救命呀??急,急,急。
- chenzhiyang(象牙芒),tiara(小菜)请进,关于CHtmlView,IWebBrowser的问题
//S_QString is a structure