注册的 COM 类的最大长度是多少?

发布于 2024-09-07 05:19:35 字数 157 浏览 1 评论 0原文

当对象被添加到 Windows 注册表时,它们会像这样显示:

MyNamespace.MyType

我似乎记得在尝试为 COM 注册它们时遇到了名称空间和类名太长的问题。在 Windows 或 COM+ 中注册类是否有最大长度限制?

When objects get added to the Windows Registry, they show up like so:

MyNamespace.MyType

I seem to remember running into issues with my namespaces and classnames being too long when trying to register them for COM. Is there a maximum length limitation in registering classes in Windows or COM+?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

喵星人汪星人 2024-09-14 05:19:35
  • 不超过 39 个字符。
  • 除一个或多个句号外,不包含标点符号(包括下划线)。
  • 不以数字开头。
  • 与任何 OLE 1 应用程序的类名不同,包括同一应用程序的 OLE 1 版本(如果有)。*

来源 = MSDN

  • Have no more than 39 characters.
  • Contain no punctuation (including underscores) except one or more periods.
  • Not start with a digit.
  • Be different from the class name of any OLE 1 application, including the OLE 1 version of the same application, if there is one.*

source = MSDN

沙与沫 2024-09-14 05:19:35

注册 COM 组件的主要方法是通过它们的 CLSID,一个固定大小的 16 字节数。一个 GUID。您可以发布 ProgID,这对于需要使用后期绑定的 COM 客户端很有用。就像脚本语言一样。

我不知道 ProgID 是否有长度限制,COM 基础结构中没有定义长度限制。也许脚本语言有一个。我知道您使用的是 VB6,根本不需要 ProgID。它更喜欢早期绑定(new ClassName,而不是 CreateObject)。这是一个好主意,因为后期绑定调用大约慢 10,000 倍。

无论如何,如果您想指定 ProgId,请使用 属性。正常格式是 AppName.ClassName,很少会测试任何类型的长度限制。

The primary way to register COM components is by their CLSID, a fixed size 16 byte number. A GUID. You can publish a ProgID, that's useful to COM clients that need to use late binding. Like scripting languages.

I have no idea if there's a length limit to ProgIDs, there isn't one defined in the COM infrastructure. Maybe the scripting language has one. I know you are using VB6, there's no need for a ProgID at all. It prefers early binding (new ClassName, not CreateObject). Which is a good idea because late bound calls are about 10,000 times slower.

Anyhoo, if you want to specify a ProgId then use the <ProgId> attribute. The normal format is AppName.ClassName, something that should rarely test any kind of length limit.

此岸叶落 2024-09-14 05:19:35

说到“程序化 ID”的随机限制......

---------------------------
Microsoft Visual Basic
---------------------------
Programmatic ID string too long '<<project_name>>.<<control_name>>'.
The Programmatic ID must be 39 characters or less.
---------------------------
OK   Help   
---------------------------

Speaking of a random limit on the the "Programmatic ID"...

---------------------------
Microsoft Visual Basic
---------------------------
Programmatic ID string too long '<<project_name>>.<<control_name>>'.
The Programmatic ID must be 39 characters or less.
---------------------------
OK   Help   
---------------------------
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文