English 中文(简体)
调用.FindByType使VB6出错,有帮助吗?[副本]
原标题:Calling .FindByType makes VB6 error out, help? [duplicate]

Possible Duplicate:
Function or interface marked as restricted, or the function uses an Automation type not supported in Visual Basic.

基本上,我只是使用uPNPDeviceFinder类搜索uPnP设备。FindByType方法,.FindByUDN有效,但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中,我得到了上面的错误,有人知道吗?谢谢

最佳回答

函数在typelib中声明为

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”此类型库。

编辑:

这里是我尝试用VB验证这个类型库,使用时风险自负。IDL是用mktyplib编译的。

请注意,您不必将vbupnp.tlb发送给您的用户,也不必在他们的机器上注册它。只需注册并仅在您的开发机器上使用它。

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签