I want to write a Delphi function to register a dll. I want the function to check if OleInitialize has already been called before it does so. I guess I'm trying to avoid the consequences of initializing twice because I'm not sure what they might be. I'm worried that my function won't handle as wide a variety of dlls as regsvr32.exe.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Take a look at the documentation:
Return Value
[...]
S_FALSE
- The COM library is already initialized on this apartment.
... and also:
Typically, the COM library is initialized on an apartment only once. Subsequent calls will succeed, as long as they do not attempt to change the concurrency model of the apartment, but will return
S_FALSE
.