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.
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)
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:
You can now add upnp.tlb instead of upnp.dll, you should no longer get the error. -
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. 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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With