简体   繁体   English

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

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

What does this error mean in VB6? 这个错误在VB6中意味着什么?

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

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) 当我调用windows xp及更高版本附带的dll的特定方法时,我一直得到它(在system32中称为upnp.dll)

This is the declaration for FindByType() as retrieved from the type library: 这是从类型库中检索的FindByType()声明:

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

Note the 2nd argument, unsigned long. 注意第二个参数,unsigned long。 VB6 doesn't support unsigned types. VB6不支持无符号类型。 It is not a problem in VB.NET or C#, they do support them. 它不是VB.NET或C#中的问题,它们确实支持它们。

This problem is fixable if you have the Windows SDK installed. 如果您安装了Windows SDK,则此问题可以修复。 You should have it if you have a recent version of Visual Studio. 如果您有最新版本的Visual Studio,则应该拥有它。 Use the Visual Studio Command Prompt, then: 使用Visual Studio命令提示符,然后:

  • run oleview.exe c:\\windows\\system32\\upnp.dll 运行oleview.exe c:\\ windows \\ system32 \\ upnp.dll
  • type Ctrl+A, Ctrl+C to copy the type library content 键入Ctrl + A,Ctrl + C复制类型库内容
  • run notepad.exe, Ctrl+V. 运行notepad.exe,Ctrl + V. Search for "unsigned" and delete it. 搜索“unsigned”并将其删除。 There are two. 那里有两个。
  • save the file to a temporary directory with the name upnp.idl 将文件保存到名为upnp.idl的临时目录中
  • run midl upnp.idl /tlb upnp.tlb 运行midl upnp.idl / tlb upnp.tlb
  • copy the generated upnp.tlb to your project directory 将生成的upnp.tlb复制到项目目录中

You can now add upnp.tlb instead of upnp.dll, you should no longer get the error. 您现在可以添加upnp.tlb而不是upnp.dll,您应该不再收到错误。 - -

Well, the error message means that you're calling a function that can't be bound by VB6, possibly due to it have parameters or a return value of a data type that VB6 doesn't support. 好吧,错误消息意味着您正在调用一个不能被VB6绑定的函数,可能是因为它有参数或VB6不支持的数据类型的返回值。 I sometimes worked around issues like this by writing a simple C++ COM object that called the function and "translated" it to be VB6 compatible. 我有时通过编写一个调用该函数的简单C ++ COM对象并将其“翻译”为VB6兼容来解决这类问题。

You can sometimes also get this error message due to various typos, but I think you've already discovered that with your search on google so I'm assuming you've already checked for that. 由于各种拼写错误,您有时也会收到此错误消息,但我认为您已经发现在谷歌上进行搜索,所以我假设您已经检查过了。

If you post your code (or at least the name of the function that you're having problems with) it's possible that you could get a better answer. 如果您发布代码(或至少是您遇到问题的函数的名称),您可能会得到更好的答案。

I got the same error but when I changed my array name the error went away. 我得到了同样的错误但是当我更改了我的数组名称时,错误就消失了。

"Map" apparently isn't an acceptable array name. “Map”显然不是一个可接受的数组名称。

error code: map(day, min) = Trim(Str(Int(r / 1000))) 错误代码: map(day, min) = Trim(Str(Int(r / 1000)))

no error code: mapsymbol(day, min) = Trim(Str(Int(r / 1000)) ) 没有错误代码: mapsymbol(day, min) = Trim(Str(Int(r / 1000))

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

相关问题 错误 Function 或接口标记为受限,或者 function 在 VB6 中使用 Visual Basic 中不支持的自动化类型 - Error Function or interface marked as restricted, or the function uses an Automation type not supported in Visual Basic in VB6 C#COM Object VBA函数或接口标记为受限或该函数使用了不支持的自动化类型 - C# COM Object VBA function or interface marked as restricted or the function uses an automation type not supported 没有 Visual Studio 的 TwinCAT 3.0 自动化接口? - TwinCAT 3.0 Automation Interface without Visual Studio? 使用类型来实例化使用受限泛型的派生类 - Using a type to instantiate a derived class which uses restricted generics 指定功能参数的类型*和*接口 - Specify type *and* interface(s) of function parameter C#函数返回类型的已实现接口 - C# function to return the implemented interface of a type 获取类型作为接口以从函数返回 - Getting a Type as an Interface to return from a function 泛型函数,泛型类型是任何接口 - generic function where generic type is any interface 泛型类型的接口中的枚举返回函数出错 - Error in enum returning function in interface with generic type GetSubKeyNames函数在C#和Visual Basic中返回不同的子项 - GetSubKeyNames function return diffrent subkeys in C# and Visual Basic
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM