Hi,
Are there any problems with using CoRegisterClassObject/ROT in .NET/CLR to
expose an object as IDispatch for communication from/to unmanaged world? It
is registered from MTAThread. The DllImport is as follows:
[DllImport ("ole32.dll")]
static extern uint CoRegisterClassObject (ref Guid rclsid,
[MarshalAs (UnmanagedType.IDispatch)]object pUnkn, ...);
I'm asking because .NET provides RegisterTypeForComClients() and it has the
following comment:
"This method, which is equivalent to calling CoRegisterClassObject in
COM...Using the RegisterTypeForComClients method can cause unpredictable
results, particularly if the application is multithreaded."
Could someone specify the "unpredictable results" referred to in the msdn
docs?
Thanks in advance
"Ying-Shen Yu[MSFT]" - 15 Jul 2004 04:40 GMT
Hi Leon,
To my understanding, it meant that when you are making this call, we have
to make sure that no other thread is simutanously calling this method.
Calling CoRegisterClassObject directly may not be helpful to resolve this
problem, since this method also uses CoRegisterClassObject internally.
The doc also says that this API is not intended to be directly used in your
code, which makes it an unsupported API.
Thanks!
Best regards,
Ying-Shen Yu [MSFT]
Microsoft Community Support
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, please remove the word "online"
before sending mail.
Leon Finker - 15 Jul 2004 12:48 GMT
Thank you
> Hi Leon,
>
[quoted text clipped - 18 lines]
> This mail should not be replied directly, please remove the word "online"
> before sending mail.