为了注册一个 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”中的相应注册表项已被删除。