我现在要实现一个IDocHostUIHandler接口的类,接口中有这样
HRESULT FilterDataObject(
IDataObject *pDO, IDataObject **ppDORet
);我的转换是:
function FilterDataObject(const pDO: IDataObject; var ppDORet: IDataObject): HRESULT;
这样是否正确?如果把var改成out,有什么不同?原接口中的ppDORet是一个**IDataObject类型,也就是指向IDataObject的指针的指针,那么在转换到Delphi函数时,通过var或者out能有效吗?盼复。
HRESULT FilterDataObject(
IDataObject *pDO, IDataObject **ppDORet
);我的转换是:
function FilterDataObject(const pDO: IDataObject; var ppDORet: IDataObject): HRESULT;
这样是否正确?如果把var改成out,有什么不同?原接口中的ppDORet是一个**IDataObject类型,也就是指向IDataObject的指针的指针,那么在转换到Delphi函数时,通过var或者out能有效吗?盼复。
解决方案 »
- 求DELPHI+ACCESS”实例“刚刚学习DELPHi,多谢!!
- 问几个简单的命令 谢了!
- 想去北京找工作,找人合租房子,请大家来讨论,散分.....
- 出错提示看不懂啊。。。是什么原因啊??多谢了
- 问InfoPower的TwwDBLookupComboDlg.急!!!
- 如何在ACCESS插入图片,请大家帮忙!!!谢谢!!
- 通过字符串变量调用控件的属性可以吗?
- Delphi中的自动输入怎么设置?
- 怎样得到年、月、日的值
- 怎样在制作安装盘时打包ODBC别名
- ComboBox额外信息和item.string相对应的问题???希望大家帮忙!~
- 如何在TWebBrowser中(编辑状态)捕获用户的粘贴事件并修改粘贴内容?
function FilterDataObject(const pDO: IDataObject; var ppDORet: IDataObject): HRESULT;
应该写为
关于out,Delphi的文档中写的:
Out Parameters
An out parameter, like a variable parameter, is passed by reference. With an out parameter, however, the initial value of the referenced variable is discarded by the routine it is passed to. The out parameter is for output only; that is, it tells the function or procedure where to store output, but doesn't provide any input.
For example, consider the procedure heading
procedure GetInfo(out Info: SomeRecordType);
When you call GetInfo, you must pass it a variable of type SomeRecordType:
var MyRecord: SomeRecordType;
...
GetInfo(MyRecord);
But you're not using MyRecord to pass any data to the GetInfo procedure; MyRecord is just a container where you want GetInfo to store the information it generates. The call to GetInfo immediately frees the memory used by MyRecord, before program control passes to the procedure.
Out parameters are frequently used with distributed-object models like COM and CORBA. In addition, you should use out parameters when you pass an uninitialized variable to a function or procedure