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);
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.
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:
- run oleview.exe c:windowssystem32upnp.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
You can now add upnp.tlb instead of upnp.dll, you should no longer get the error.
-
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…