一、使用系统自带工具regsvr32注册
注册: regsvr32 xxxx.dll
注销: regsvr32 /u xxxx.dll
二、使用QT自带工具idc.exe注册
使用说明:
D:\linux-share-dir\idc2>idc.exe -?
Usage: idc [options] [input_file]
Interface Description Compiler 5.12.6
Options:
-?, /h, -h, -help Displays this help.
/v, -v Displays version information.
/version, -version <version> Specify the interface version.
/idl, -idl <file> Specify the interface definition file.
/tlb, -tlb <file> Specify the type library file.
/regserver, -regserver Register server.
/unregserver, -unregserver Unregister server.
Examples:
idc -regserver l.dll Register the COM server l.dll
idc -unregserver l.dll Unregister the COM server l.dll
idc l.dll -idl l.idl -version 2.3 Writes the IDL of the server dll to the file idl.
The type library will have version 2.3
idc l.dll -tlb l.tlb Replaces the type library in l.dll with l.tlb
示例:
注册: idc.exe xxx.dll /regserver
注销: idc.exe xxx.dll /unregserver
为了方便注册COM服务器,一般会在需要注册的dll同级目录下编写一个脚本,双击运行即可注册或者卸载。
示例:
cd /d %~dp0
@regsvr32 ActiveQtServer.dll
@exit