Anonymous
January 05, 2006
"after talking to the COM guys"
Oooh, there's still COM guys at Microsoft? That's good to hear! All this .NET stuff, sometimes you wonder... :)
Anonymous
January 05, 2006
In this case the guy was from the COSD engineering excellence center, but yes, there are COM guys still around.
Anonymous
January 05, 2006
If I recall correctly, I believe you need to add typelib key under the <clsid> node, typelib registration data, and proxy stub interface registration data.
Or, more explicitely:
Key: HKCRClasses<clsid>TypeLib Default: TypeLib GUID associated with the class Key: HKCRClasses<clsid>Version Default: version of class (and associated typelib) Key: HKCRTypeLib<typelibid><version><locale>win32 Default: path to file holding typelib data <TypeLibid> = typelib guid <version> = version of typelib (and associated classes) <locale> = hex lcid (not 100% certain on this one) Key: HKCRInterface<ifaceid>ProxyStubClsid Default: proxy stub class Key: HKCRInterfaces<ifaceid>Typelib Version - typelib version
It may be possible to omit some of these values ... there might be reasonable assumptions made if version information is omitted, and it might be possible to leave out some of the typelib references. But I'm not going to experiment to find out; I'll just wait for your next article instead. ;)
Anonymous
January 06, 2006
The comment has been removed
Anonymous
January 06, 2006
"It's also not accessible from script, or from the CLR (because there's no typelib registered)."
You don't need a registered typelib to use COM objects from the CLR. All you nend is a managed representation of the COM interfaces. Tlbimp creates that from a typelib, but you can just as well write them manually by translating the IDL for example.
Anonymous
January 06, 2006
mattias, yes, but if you want interop to work automatically, you need the typelib.
Anonymous
January 06, 2006
Larry, my post was intended to answer "What do you need to add if you need your object to work cross-process?"
Anonymous
January 06, 2006
mirobin, sorry, I didn't realize that.
Anonymous
January 06, 2006
No worries; in retrospect, I didn't make it particularly clear either. :)
Anonymous
January 11, 2006
>... marked with a threading model of "both", > it can't be used from the STA unless
This is wrong. When martk at Both you do not need to implement IMarshall when creating object from an STA. You woulkd need to do this if the object was marked as Free.
Bye, Mt
Anonymous
January 11, 2006
The comment has been removed
Anonymous
January 11, 2006
The comment has been removed
Anonymous
January 12, 2006
MT, I'll check with Don, but afaik, the only time you'll have problems aggregating the FTM is if you're playing apartment games with your referenced COM objects. In other words, if you ensure that every referenced COM object matches your threading model you should be fine.
If the threading model doesn't match, then you should put the COM object in the GIT, which will correctly handle marshalling that object for you.
This is a general purpose rule, IMHO - if the object you're referencing doesn't match your object's threading model (and by definition, COM objects with a threading model of "both" don't match your objects threading model (since objects with a threading model of "both" take on the threading model of the thread that created them)), then you need to put the object in the GIT.