Cha*_*ang 3 windows com winapi
要注册COM服务器,我们运行类似于提升模式的东西:
regsvr32.exe com.dll
Run Code Online (Sandbox Code Playgroud)
要执行每用户注册,请在用户帐户中执行:
regsvr32.exe /n /i:user com.dll
Run Code Online (Sandbox Code Playgroud)
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)
Run Code Online (Sandbox Code Playgroud)
在Delphi中创建COM服务器时,导出了以下方法:
exports
DllGetClassObject,
DllCanUnloadNow,
DllRegisterServer,
DllUnregisterServer,
DllInstall;
Run Code Online (Sandbox Code Playgroud)
我注意到这些会发生:
我对参数/ n和/ i以及DllUnregisterServer和DllInstall感到困惑.有什么不同吗?
另外,为什么"/ u/n/i:user"调用Dllinstall?我注意到"HKEY_CURRENT_USER\Software\Classes"中相应的注册表项已被删除.
DllInstall()的文档解释了差异:
DllInstall仅用于应用程序安装和设置.它不应该由应用程序调用.它的用途与DllRegisterServer或DllUnregisterServer类似.与这些函数不同,DllInstall采用输入字符串,可用于指定各种不同的操作.这允许基于适当的任何标准以多种方式安装DLL.
要在regsvr32中使用DllInstall,请添加一个"/ i"标志,后跟一个冒号(:)和一个字符串.该字符串将作为pszCmdLine参数传递给DllInstall.如果省略冒号和字符串,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
| 归档时间: |
|
| 查看次数: |
10541 次 |
| 最近记录: |