创建注册表文件
要使 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\R23.1\ActiveXCLSID
\AsdkPoly = {uuid of coclass}
对类型库中的每个 coclass 和 interface 重复 coclass 和 interface 部分。用于构建类型库的 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 苏公网安备32011402011833)
GMT+8, 2025-12-16 07:30
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.