COM DLL SimpleATLDLL.idl IDL语法一例
// SimpleATLDLL.idl : SimpleATLDLL 的 IDL 源
//
// 此文件将由 MIDL 工具处理以
// 产生类型库(SimpleATLDLL.tlb)和封送处理代码。
import "oaidl.idl";
import "ocidl.idl";
//---------------------xpGeometryType 枚举类型
//object,
//uuid(05643780-AF84-4073-9117-A033923F4BCB),
//pointer_default(unique)
typedef
[
uuid(05643780-AF84-4073-9117-A033923F4BCB),
v1_enum,
helpstring("xpGeometryType enum")
]
enum EnumXpGeometryType{
xpGeometryNull = 0,
xpGeometryPoint = 1,
xpGeometryMultipoint = 2,
xpGeometryPolyline = 3,
xpGeometryPolygon = 4,
xpGeometryEnvelope = 5,
xpGeometryPath = 6,
xpGeometryAny = 7,
xpGeometryMultiPatch = 9,
xpGeometryRing = 11,
xpGeometryLine = 13,
xpGeometryCircularArc = 14,
xpGeometryBezier3Curve = 15,
xpGeometryEllipticArc = 16,
xpGeometryBag = 17,
xpGeometryTriangleStrip = 18,
xpGeometryTriangleFan = 19,
xpGeometryRay = 20,
xpGeometrySphere = 21,
xpGeometryTriangles = 22,
} enumxpGeometryType;
//---------------------enum test
typedef
[
uuid(F42ABD57-ECE8-42BF-AABF-E43FB0EF3933),
v1_enum,
helpstring("enum test")
]
enum EnumWorkdays{
[helpstring("Monday")]Monday=2,
[helpstring("Tuesday")]Tuesday=3,
[helpstring("Wednesday")]Wednesday=4,
[helpstring("Thursday")]Thursday=5,
[helpstring("Friday")]Friday=6
} enumWorkdays;
//---------------------tagImageFMT
typedef
[
uuid(F1A3AFB8-EC53-4bc9-A0D7-5F91D65BCACB),
version(1.0),
helpstring("tagImageFMT enum Type")
]
enum EnumImageFMT
{
[helpstring("TIF")] IF_TIFF=0,
[helpstring("BMP")] IF_BMP=1,
}ImageFMT;
//----------------系统定义的接口ISimpleATLClass
[
object,
uuid(FDE36D69-0004-46B3-90A3-AC9681D9B289),
dual,
nonextensible,
helpstring("ISimpleATLClass 接口"),
pointer_default(unique)
]
interface ISimpleATLClass : IDispatch{ //IDispatch/IUnknown
//定义 加法方法
HRESULT Add([in] long a,[in] long b,[out,retval] long *pnVal);
};
[
object,
uuid(6F4B7079-5E64-45AF-B127-231DC081716A),
dual,
nonextensible,
helpstring("ISecendATL 接口"),
pointer_default(unique)
]
interface ISecendATL:IDispatch //IUnknown
{
//定义 加法方法
[id(1), helpstring("方法Add")]
HRESULT Add([in] long a,[in] long b,[out,retval] long *pnVal);
//-------------
[id(2), helpstring("方法Sub")]
HRESULT Sub([in] long a,[in] long b,[out,retval] long *pnVal);
};
//----------------自定义接口IMathe
//[
// object,
// uuid(CFA4D945-B4C7-46CE-88F6-7724F43A614A),
// dual,
// nonextensible,
// helpstring("IMathe 接口"),
// pointer_default(unique)
//]
//interface IMathe : IUnknown
//{
// [helpstring("method Add")]
// HRESULT Add([in] long n1, [in] long n2, [out,retval] long *pnVal);
//};
//----------------
//---------------------------------------------
[
uuid(35B84547-5983-4781-8761-71D5EB474079),
version(1.0),
helpstring("SimpleATLDLL 2.0 类型库"),
]
library SimpleATLDLLLib
{
importlib("stdole2.tlb");
//----------------
/*[
uuid(666F0945-D7D2-4A74-A0E9-351E459A5910),
helpstring("xpGeometryType enum")
]
enum xpGeometryType
{
[default] enum xpGeometryType;
};*/
//--------------
[
uuid(958A3544-CD9D-408A-9859-3271F168C0A4),
helpstring("SimpleATLClass Class")
]
coclass SimpleATLClass
{
[default] interface ISimpleATLClass;
interface ISecendATL;
};
enum EnumXpGeometryType;
enum EnumWorkdays;
enum EnumImageFMT;
//--------------
};
//------------------------------