标记为受限的函数或接口,或函数使用 Visual Basic 不支持的自动化类型 [英] Function or interface marked as restricted, or the function uses an Automation type not supported in Visual Basic

查看:21
本文介绍了标记为受限的函数或接口,或函数使用 Visual Basic 不支持的自动化类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个错误在 VB6 中是什么意思?

What does this error mean in VB6?

函数或接口标记为受限,或函数使用 Visual Basic 不支持的自动化类型.

Function or interface marked as restricted, or the function uses an Automation type not supported in Visual Basic.

当我调用 windows xp 及更高版本附带的 dll 的特定方法时(在 system32 中称为 upnp.dll),我不断得到它

I keep getting it when i call a particular method of a dll that comes with windows xp and beyond (in system32 called upnp.dll)

推荐答案

这是从类型库中检索到的 FindByType() 的声明:

This is the declaration for FindByType() as retrieved from the type library:

    HRESULT FindByType(
                    [in] BSTR bstrTypeURI, 
                    [in] unsigned long dwFlags, 
                    [out, retval] IUPnPDevices** pDevices);

注意第二个参数,无符号长.VB6 不支持无符号类型.这在 VB.NET 或 C# 中不是问题,它们确实支持它们.

Note the 2nd argument, unsigned long. VB6 doesn't support unsigned types. It is not a problem in VB.NET or C#, they do support them.

如果您安装了 Windows SDK,则可以解决此问题.如果你有最新版本的 Visual Studio,你应该拥有它.使用 Visual Studio 命令提示符,然后:

This problem is fixable if you have the Windows SDK installed. You should have it if you have a recent version of Visual Studio. Use the Visual Studio Command Prompt, then:

  • 运行 oleview.exe c:windowssystem32upnp.dll
  • 按Ctrl+A、Ctrl+C复制类型库内容
  • 运行 notepad.exe,Ctrl+V.搜索未签名"并将其删除.有两个.
  • 将文件保存到名为 upnp.idl 的临时目录中
  • 运行 midl upnp.idl/tlb upnp.tlb
  • 将生成的 upnp.tlb 复制到你的项目目录

您现在可以添加 upnp.tlb 而不是 upnp.dll,您应该不再收到错误消息.-

You can now add upnp.tlb instead of upnp.dll, you should no longer get the error. -

这篇关于标记为受限的函数或接口,或函数使用 Visual Basic 不支持的自动化类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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