简体   繁体   English

如何从 vb6 ocx 获取“miscStatus”?

[英]How get "miscStatus" from vb6 ocx?

How I can get miscStatus for VB6 ocx from .net without need for register it on local computer?如何从 .net 获取 VB6 ocx 的miscStatus而无需在本地计算机上注册它?

I use TLI (TypeLibInfo) for all other info about ocx but this property i do not know how get?我使用TLI (TypeLibInfo) 获取有关 ocx 的所有其他信息,但此属性我不知道如何获得?

Did someone know how regsvr32 generate MiscStatus when register ocx?有人知道注册ocx时regsvr32如何生成MiscStatus吗?


EDIT: I forget say that I want obtain miscStatus from ocx without need for register it on local computer.编辑:我忘了说我想从 ocx 获取miscStatus而无需在本地计算机上注册它。

You can try locating the OCX in the Registry using Registry.GetValue .您可以尝试使用Registry.GetValue在注册表中定位 OCX。 It sounds like you probably already have the OCX's CLSID:听起来您可能已经拥有 OCX 的 CLSID:

Dim ocxClsid As String = "13DE4A42-8D21-4C8E-BF9C-8F69CB068FCA" ' Replace with your CLSID
Dim key As String = "HKEY_CLASSES_ROOT\CLSID\{" & ocxClsid & "}\"

Dim readValue = My.Computer.Registry.GetValue(
    key, "MiscStatus", Nothing)

I don't believe there is a standard tool like TLI that can do this.我不相信有像 TLI 这样的标准工具可以做到这一点。 miscStatus appears to be written during registration by the DLLRegisterFunction call, which is provided by the DLL/OCX itself and can do basically anything it wants. miscStatus似乎是在注册期间由DLLRegisterFunction调用编写的,该调用由 DLL/OCX 本身提供,基本上可以做任何它想做的事情。

For instance, the registry values to be written during registration might be contained in a resource .例如,注册期间要写入的注册表值可能包含在资源中 But that is up to the programmer.但这取决于程序员。

Looking at some older source code of regsvr32 itself you can see it totally omits the keyword miscstatus .查看 regsvr32 本身的一些较旧的源代码,您可以看到它完全省略了关键字miscstatus I think this confirms that its value isn't required to be stored in any standardized way.我认为这证实了它的价值不需要以任何标准化的方式存储。

If you absolutely cannot register the OCX on your dev/build PC, the next best thing I can think of would be to register it in some kind of sandbox - like a VM, or Sandboxie , or maybe even Docker.如果你绝对不能在你的开发/构建 PC 上注册 OCX,我能想到的下一个最好的事情是在某种沙箱中注册它 - 比如 VM,或Sandboxie ,甚至 Docker。 Then you can throw away the sandbox after reading the registry value.然后你可以在读取注册表值后扔掉沙箱。 But I've never really tried this.但我从来没有真正尝试过这个。


Also, consider if that value really is essential.另外,请考虑该值是否真的必不可少。 If you leave it out, does anything break?如果你把它放在外面,有什么坏处吗? It may be that many of the misc status flags are not set or don't matter for your particular applicaiton.可能许多其他状态标志未设置或对您的特定应用程序无关紧要。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM