Ok to call CoInitialize in the file dialogs?

Michael Jung mjung at iss.tu-darmstadt.de
Tue Nov 8 13:48:57 CST 2005


Hi Rob,

On Tuesday 08 November 2005 19:59, Robert Shearman wrote:
> The only objection is that in general it is bad to force a threading
> model and that the caller should be the one specifying it. 

I guess that's not a problem.

If COM isn't initialized prior to the call to SHBrowseForFolder it will also 
be uninitialized after the call. The caller can then call CoInitializeEx 
afterwards (I'm assuming here that it's ok to do 
CoInitializeEx(COINIT_APARTMENTTHREADED, NULL); CoUnintialize(); 
CoInitializeEx(COINIT_MULTITHREADED, NULL); Is that correct?).

If COM is already initialized with the same threading model as specified in 
SHBrowseForFolder's CoInitializeEx, it will succeed with S_FALSE.

If COM is already initialized with a different threading model, CoInitializeEx 
will fail. But then, it's already initialized anyway and everything is fine. 
And we won't call CoUninitialize before returning from SHBrowseForFolder in 
this case.

Did I understand this stuff correctly?

Thanks for your reply.
-- 
Michael Jung
mjung at iss.tu-darmstadt.de



More information about the wine-devel mailing list