[基本上,我只是使用uPNPDeviceFinder类.FindByType方法,.FindByUDN来搜索uPnP设备,但是FindByType给出了错误:
VB6尝试调用该方法时出现编译错误:
Function or interface marked as restricted, or the function
uses an Automation type not supported in Visual Basic.
我不知道这甚至意味着什么,或者我为什么得到它。我正在引用和使用yoru system32目录中找到的upnp.dll文件-当我在VS2010中引用并使用它时(例如vb.net),它都可以工作并且没有发现问题,但是在VB6中,我得到了上面的错误,有人有什么想法吗?谢谢。
HRESULT FindByType(
[in] BSTR bstrTypeURI,
[in] unsigned long dwFlags,
[out, retval] IUPnPDevices** pDevices);
并且无符号参数dwFlags
在VB6中不可用
Function FindByType(bstrTypeURI As String, dwFlags As <Unsupported variant type>) As UPnPDevices
您必须通过将参数类型更改为兼容的VB6类型来“ VB-fy”此类型库。编辑:
Here是我尝试VB-fy此类型库,使用后果自负。用mktyplib
编译的IDL。请注意,您不必将
vbupnp.tlb
交付给用户,也不必在他们的计算机上注册。只需在您的开发机器上注册并使用它即可。