读书人

请高手讲解一上CreateOleObject创建的

发布时间: 2012-12-29 10:28:09 作者: rapoo

请高手讲解一下CreateOleObject创建的对象
比如
var
a,b:Variant;
....
a:=CreateOleObject('...');

问题
1、a,b声明Variant变量和OleVariant变量有什么区别;
2、假如b:=a;b是引用a的指针,还是a的实例;如果只是引用指针的话,如何b拷贝a的一份实例;
3、退出程序时,a要不要释放,如何释放
4、a能不能写成流文件
[解决办法]
The OleVariant type exists on both the Windows and Linux platforms. The main difference between Variant and OleVariant is that Variant can contain data types that only the current application knows what to do with. OleVariant can only contain the data types defined as compatible with OLE Automation which means that the data types that can be passed between programs or across the network without worrying about whether the other end will know how to handle the data.

OleVariant可以理解为一个容器,Variant不能容纳对象
[解决办法]
CreateOleObject创建的对象,如果是接口,一般置为nil,如果是对象则调用析构函数释放。

读书人网 >.NET

热点推荐