要注册 COM 服务器,我们在提升模式下运行类似的命令:
regsvr32.exe com.dll
要执行每用户注册,请在用户帐户中执行:
regsvr32.exe /n /i:user com.dll
regsvr32.exe 支持以下参数:
/u - Unregister server
/i - Call DllInstall passing it an optional [cmdline]; when used with /u calls dll uninstall
/n - do not call DllRegisterServer; this option must be used with /i
/s – Silent; display no message boxes (added with Windows XP and Windows Vista)
当在Delphi中创建COM服务器时,导出了这些方法:
exports
DllGetClassObject,
DllCanUnloadNow,
DllRegisterServer,
DllUnregisterServer,
DllInstall;
我注意到这些会发生:
- “regsvr32.exe com.dll”调用DllRegisterServer。
- “regsvr32.exe /u com.dll”调用DllUnregisterServer。
- “regsvr32.exe /n /i:user com.dll”调用 DllInstall。
- “regsvr32.exe /u /n /i:user com.dll”调用 DllInstall。
我对参数 /n 和 /i 以及 DllUnregisterServer 和 DllInstall 感到困惑。有什么不同吗?
另外,为什么“/u /n /i:user”调用Dllinstall?我注意到“HKEY_CURRENT_USER\Software\Classes”中相应的注册表项已被删除。
DllInstall() 的文档解释差异:
DllInstall 仅用于应用程序安装和设置。它
不应由应用程序调用。它的目的类似于
DllRegisterServer 或 DllUnregisterServer。与这些功能不同的是,
DllInstall 接受一个输入字符串,该字符串可用于指定
各种不同的动作。这允许将 DLL 安装在
不止一种方式,基于任何适当的标准。
要将 DllInstall 与 regsvr32 一起使用,请添加“/i”标志,后跟冒号
(:) 和一个字符串。该字符串将作为 DllInstall 传递给
pszCmdLine 参数。如果省略冒号和字符串,pszCmdLine
将被设置为 NULL。以下示例将用于安装
DLL。
regsvr32 /i:"Install_1" dllname.dll
DllInstall 被调用
bInstall 设置为 TRUE,pszCmdLine 设置为“Install_1”。要卸载一个
DLL,使用以下内容:
regsvr32 /u /i:"Install_1" dllname.dll
和
以上两个示例,DllRegisterServer 或 DllUnregisterServer
也会被调用。要仅调用 DllInstall,请添加“/n”标志。
regsvr32 /n /i:"Install_1" dllname.dll
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)