接触VC之四:COM组件模型基础
2006-07-19 11:36:48 来源:WEB开发网核心提示: 下面给出我们这个组件对象的IDL描述和图形描述#include "olectl.h"import "oaidl.idl";import "ocidl.idl";[object,uuid(6AAF876E-FCED-4ee0-B5D
下面给出我们这个组件对象的IDL描述和图形描述
#include "olectl.h"
import "oaidl.idl";
import "ocidl.idl";
[
object,
uuid(6AAF876E-FCED-4ee0-B5D3-63CD6E2242F5),
nonextensible,
helpstring("IPhysiology 接口"),
pointer_default(unique)
]
interface IPhysiology : IUnknown
{
void eat(Food in);
void drink(Liquid in);
Somethings toilet();
};
[
object,
uuid(5F144D5C-A20C-42e7-8F91-4D5CAE430B29),
nonextensible,
helpstring("IPsychics 接口"),
pointer_default(unique)
]
interface IPsychics : IUnknown
{
Sound laugh();
Sound cry();
Sound angry();
};
[
object,
uuid(5F144D5C-A20C-42e7-8F91-4D5CAE430B29),
nonextensible,
helpstring("IDynamics 接口"),
pointer_default(unique)
]
interface IDynamics : IUnknown
{
Speed run() = 0;
Speed walk() = 0;
Interval jump() = 0;
};
[
uuid(6CC7B329-B92F-4A8F-9CDD-1AB6D7E4CF4D),
version(1.0),
helpstring("OLEOBJECT 1.0 类型库")
]
library OLEOBJECTLib
{
importlib("stdole2.tlb");
[
uuid(62FD0E39-DA84-4B19-BAB0-960A27AC2B71),
helpstring("OlePaint Class")
]
coclass OlePaint
{
[default] interface IPhysiology,
interface IPsychics,
interface IDynamics
};
};
请伃细,观察上面的描述IDL代码和图形。并不是太难吧。
更多精彩
赞助商链接