问题描述
这是什么错误VB6是什么意思?
What does this error mean in VB6?
Function or interface marked as restricted, or the function uses an Automation type not supported in Visual Basic.
我不断收到它时,我打电话与Windows XP及以后(在SYSTEM32称为upnp.dll)一个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)
任何人任何想法?谷歌是没有帮助的。
Anyone any ideas? google wasn't helpful
推荐答案
这是声明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);
请注意第二个参数,unsigned long类型。 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:\ WINDOWS \ SYSTEM32 \ upnp.dll
- 键入Ctrl + A,按Ctrl + C复制型库的内容
- 运行的notepad.exe,按Ctrl + V。搜索签名,并删除它。有两个。
- 将文件保存到一个名为upnp.idl 系统临时目录
- 运行MIDL upnp.idl / TLB upnp.tlb
- 复制生成的upnp.tlb到项目目录
- run oleview.exe c:\windows\system32\upnp.dll
- type Ctrl+A, Ctrl+C to copy the type library content
- run notepad.exe, Ctrl+V. Search for "unsigned" and delete it. There are two.
- save the file to a temporary directory with the name upnp.idl
- run midl upnp.idl /tlb upnp.tlb
- copy the generated upnp.tlb to your project directory
您现在可以添加,而不是upnp.dll upnp.tlb,你应该不会再出现错误。 -
You can now add upnp.tlb instead of upnp.dll, you should no longer get the error. -
这篇关于函数或接口标记为受限制,或该函数使用不支持Visual Basic中的自动化类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!