注册托管COM组件时是否需要“实施类别”键? [英] Is the 'Implemented Categories' key needed when registering a Managed COM Component?

查看:138
本文介绍了注册托管COM组件时是否需要“实施类别”键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

手动注册COM Interop的托管类时,需要某些注册表项。例如

When registering a managed class for COM Interop by hand, certain registry keys are needed. For example

HKEY_CLASSES_ROOT
  CLSID\[My Cls Id]
    InprocServer32
     (Default) = "mscoree.dll"
     Assembly = [My assembly name]
     etc.

我注意到,当VS为COM Interop注册一个库时,它还会添加一个密钥

I've noticed that when VS registers a library for COM Interop, it also adds a key

HKEY_CLASSES_ROOT
  CLSID\[My Cls Id]
    Implemented Categories
      {62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}

此键的作用是什么,它绝对必要吗?据我所知,没有生命就可以继续生活,但是也许我没有遇到需要生命的情况。

What is this key for, and is it absolutely necessary? As far as I can tell, life goes on just fine without it, but maybe I'm not encountering the circumstances where it is needed.

推荐答案

这是CATID,是组件类别。控制主机可以使用它来过滤出现在工具箱中的项目,仅提供实现预期接口集的项目。

It is a CATID, a component category. A control host can use it to, say, filter items that appears in a toolbox, only offering ones that implement an expected set of interfaces.

您可以看到 HKCR\组件类别注册表项中的已知组件类别。 Regasm.exe使用的意思是此COM服务器在.NET中实现。知道这很有用,因为.NET程序不应使用以托管语言实现的COM服务器,而应直接使用程序集中的元数据。

You can see a list of known component categories in the HKCR\Component Categories registry key. The one that Regasm.exe uses means "this COM server is implemented in .NET". Which is kinda useful to know since a .NET program should not use a COM server that is implemented in a managed language, it should use the metadata in the assembly directly.

CATID没有充分记录。这使它们变得毫无用处,如果您只是忽略它们,几乎不会遇到麻烦。如果某些控制主机供应商要求您使用CATID来使您的COM服务器在其主机中可用,则他们将明确告知您。

CATIDs are not well documented. Which makes them fairly useless, you'll rarely have trouble if you simply omit them. If some control host vendor requires you to use a CATID to make your COM server usable in their host, they'll let you know about that explicitly.

这篇关于注册托管COM组件时是否需要“实施类别”键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆