.idl与.odl的区别
来源:互联网 发布:sql中distinct是啥意思 编辑:程序博客网 时间:2024/05/16 14:28
A:
odl和.idl在com中的功能相同.
前者是ActiveX中的 后者是ATL中.
可在前者的文件中 用 #import "XXXXX.idl " 的方式包含后者. 反过来没有试过.
B:
odl ---对象描述语言
idl ---接口描述语言
其实是一个功能就是在写法上有些不同,eg:
odl:
[
uuid(3C591B20-1F13-101B-B826-00DD01103DE1), // LIBID_Lines.
helpstring( "Lines 1.0 Type Library "),
lcid(0x09),
version(1.0)
]
library Lines
{
importlib( "stdole.tlb ");
[
uuid(3C591B25-1F13-101B-B826-00DD01103DE1), // IID_Ipoint.
helpstring( "Point object. "),
oleautomation,
dual
]
interface IPoint : IDispatch
{
[propget, helpstring( "Returns and sets x coordinate. ")]
HRESULT x([out, retval] int* retval);
[propput, helpstring( "Returns and sets x coordinate. ")]
HRESULT x([in] int Value);
[propget, helpstring( "Returns and sets y coordinate. ")]
HRESULT y([out, retval] int* retval);
[propput, helpstring( "Returns and sets y coordinate. ")]
HRESULT y([in] int Value);
}
[
uuid(3C591B21-1F13-101B-B826-00DD01103DE1), // CLSID_Lines.
helpstring( "Lines Class "),
appobject
]
coclass Lines
{
[default] interface IPoint;
interface IDispatch;
}
}
idl:
[
uuid(3C591B25-1F13-101B-B826-00DD01103DE1), // IID_Ipoint.
helpstring( "Point object. "),
oleautomation,
dual
]