为了使 COM 服务器完全正常运行,必须向系统注册所有组件及其各自的接口。此外,还必须注册类型库,以便可用于实现组件。IDispatch 注册表项通常在安装软件期间创建。COM 服务器必须注册以下信息:
您将在下面找到有助于创建注册表 (REG) 文件的信息,该文件标识 COM 服务器所需的最小信息量。REG 文件对于从安装脚本创建注册表项很有用。 以下是一般格式,以compoly.reg为例: REGEDIT
; type library entries
HKEY_CLASSES_ROOT\TypeLib\{uuid of type library}
HKEY_CLASSES_ROOT\TypeLib\{uuid of type library}\1.0 =
compoly 1.0 Type Library HKEY_CLASSES_ROOT\TypeLib\
{uuid of type library}\1.0\HELPDIR = x:\some\path\to
HKEY_CLASSES_ROOT\TypeLib\{uuid of type library}\1.0\0\win32 =
x:\some\path\to\compoly.tlb
HKEY_CLASSES_ROOT\TypeLib\{uuid of type library}\1.0\9\win32 =
x:\some\path\to\compoly.tlb
; coclass entries
HKEY_CLASSES_ROOT\CLSID\{uuid of coclass} = ComPolygon Class
HKEY_CLASSES_ROOT\CLSID\{uuid of coclass}\InProcServer32 =
x:\some\path\to\compoly.dll
; interface entries
HKEY_CLASSES_ROOT\Interface\{uuid of interface} =
IComPolygon Interface
HKEY_CLASSES_ROOT\Interface\{uuid of interface}\TypeLib =
{uuid of type library}
HKEY_CLASSES_ROOT\Interface\{uuid of interface}\ProxyStubClsid32 =
{00020424-0000-0000-C000-000000000046}
; AcRxClass name
HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\ObjectDBX\R24.0\ActiveXCLSID
\AsdkPoly = {uuid of coclass}
您可以为类型库中的每个 coclass 和接口重复 coclass 和接口部分。用于生成类型库的 IDL 文件将包含填写上述空白所需的所有 uuid。以下是来自compoly.idl的注释摘录,用于标识每个uuid。 [ // uuid of type lib. // uuid(45C7F028-CD9A-11D1-A2BD-080009DC639A), version(1.0), helpstring("compoly 1.0 Type Library") ] library COMPOLYLib { // ... Code cut out for brevity. // IComPolygon interface [ object, // uuid of interface // uuid(45C7F035-CD9A-11D1-A2BD-080009DC639A), dual, helpstring("IComPolygon Interface"), pointer_default(unique) ] interface IComPolygon : IAcadEntity { // ... Code cut out for brevity. }; // ... Code cut out for brevity. // ComPolygon coclass [ // uuid of coclass // uuid(45C7F036-CD9A-11D1-A2BD-080009DC639A), helpstring("ComPolygon Class"), noncreatable ] coclass ComPolygon { [default] interface IComPolygon; [source] interface IAcadObjectEvents; }; }; 有关特定于项目的 REG 文件示例,请参阅生成和注册 COM DLL。 |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )
GMT+8, 2024-5-19 13:50
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.