测试 Active X DLL - 运行时错误 91 对象变量或未设置块变量 [英] Testing Active X DLL - runtime error 91 object variable or With block variable not set

查看:26
本文介绍了测试 Active X DLL - 运行时错误 91 对象变量或未设置块变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个骨架 Active X DLL,它的 Instancing 属性设置为 MultiUse,并且只有一个函数除了弹出一个消息框说它已被调用之外什么都不做.

I created a skeleton Active X DLL with its Instancing property set to MultiUse and only one function which does nothing but pop up a message box saying that it has been called.

然后我创建了一个测试程序并将 DLL 添加到它的引用中.

Then I created a test program and added the DLL to its References.

我添加了代码来声明 DLL 的类模块的变量、创建新对象并调用函数.

I added code to declare a variable of the DLL's Classmodule, to create a new object and to call the function.

在所有情况下,我都使用了 Intellisense 代码完成,所以 VB6 肯定是关于 DLL 和它的类 &方法.

In all cases I used Intellisense code completion, so VB6 certainly about the DLL and it's class & method.

但是,当我运行测试器时,它会在尝试创建新对象时报告运行时错误 91 对象变量或未设置块变量".

However, when I run the tester it reports runtime "error 91 object variable or With block variable not set" when trying to create the New object.

这对我来说是新领域,所以希望它是显而易见的.

This is new territory for me, so hopefully it is something obvious.

更新:我在 DLL fn() 中添加了一个消息框来说明它已被调用,然后访问了一个使用 Active X 调用 DLL 的真实网站并看到了消息框 - 但我仍然在 VB 测试应用程序中获取错误(!?)

Update: I added a message box in a DLL fn() to say that it had been called, then went to a real life web site that uses Active X to call into the DLL and saw the message box - but I still get the error in a VB tester application(!?)

推荐答案

如果你能把调用代码和 DLL 类贴出来,会更容易找到问题.

It would be easier to find the problem if you could post the calling code and the DLL class.

这是一个猜测.您是否还记得创建新对象的行中的 Set?

Here's a guess. Have you remembered the Set on the line that creates the new object?

正确的代码

Set obj = New MyDLL.MyObject

错误代码

obj = New MyDLL.MyObject

这篇关于测试 Active X DLL - 运行时错误 91 对象变量或未设置块变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆