在调试DLL时,老是出现“类不支持自动化或不支持期待的接口”,怎么回事?

dageming 2001-07-19 10:07:26
在调试DLL有时行有时不行,都是在声明实例时出的错,这和DLL和桩子程序的启动次序有关吗?
...全文
384 17 打赏 收藏 转发到动态 举报
写回复
用AI写文章
17 条回复
切换为时间正序
请发表友善的回复…
发表回复
dageming 2001-07-19
  • 打赏
  • 举报
回复
TO tele(tele)
太谢谢了
tele 2001-07-19
  • 打赏
  • 举报
回复
msdn中所说:(搜索430)
PRB: Instantiating a Project-Compatible Server Causes Error 430
ID: Q190131


--------------------------------------------------------------------------------
The information in this article applies to:

Microsoft Visual Basic Learning, Professional, and Enterprise Editions for Windows, version 6.0

--------------------------------------------------------------------------------


SYMPTOMS
Instantiating a class within a server that has been previously compiled but is now running within the Visual Basic IDE, causes run-time error 430.



CAUSE
When a Visual Basic project is compiled with Project Compatibility, the CLSID remains the same while the IID changes for subsequent builds. Therefore, attempting to create the specific class in the "compatible" server generates the following error because the specific IID has changed and no longer exists:


Run-time error '430':
Class does not support Automation or does not support expected interface



RESOLUTION
Use Binary Compatibility.



STATUS
This behavior is by design.



MORE INFORMATION

Steps to Reproduce Behavior
Start a new ActiveX DLL project in Visual Basic. Class1 is created by default.


From the Project menu, select Project Properties, and then change the Project Name to SPP2.


From the File menu, select Make SPP2.DLL.


Add the following code to the code module of Class1:

Private Sub Class_Initialize()
Debug.Print "Initialize"
End Sub



Start a second instance of Visual Basic and create a new Standard EXE project. Form1 is created by default.


Select References from the Project menu, and add a reference to SPP2.dll.


In Form1, place the following code:

Private Sub Form_Load()
Dim x As SPP2.Class1
Set x = New Class1
End Sub



Switch back to the first instance of Visual Basic and run SPP2.


Switch back to the second instance of Visual Basic and press the F8 key to step into the code.


Continue to press the F8 key until the Error 430 DialogBox pops up.



Additional query words:

Keywords : kbActiveX kbAppSetup kbide kbVBp kbVBp600 kbGrpVB kbDSupport
Version : :6.0
Platform :
Issue type : kbprb
Technology :


Last Reviewed: October 4, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.




--------------------------------------------------------------------------------
Send feedback to MSDN.Look here for MSDN Online resources.
dageming 2001-07-19
  • 打赏
  • 举报
回复
我做了两个DLL,一个是好的,另外一个就是这个毛病,奇怪
hz1101 2001-07-19
  • 打赏
  • 举报
回复
你再重新引用一下(若引用中有MISS..,则去掉此引用,关闭窗口再重新引用),在定义的时候,不是定义你引用的名称,而是名称.YYY)
dageming 2001-07-19
  • 打赏
  • 举报
回复
在运行到Set XXX=NEW YYY 是出错
“实时错误 ’430’
类不支持自动化或不支持期待的接口”
hz1101 2001-07-19
  • 打赏
  • 举报
回复
那就麻烦了,你能将你的操作步骤和错误码贴出来吗?(比如先将DLL编译-->,再建一个新工程进行引用-->定义此DLL的对象(用NEW,若定义时不用NEW,在使用前必须Set XXX=NEW YYY)-->给对象各属性赋值——>调用方法——>运行,若出错请贴出错误码!
dageming 2001-07-19
  • 打赏
  • 举报
回复
hz1101(我学!我学!!我学!!!...) 

哦,知道了,你说的这个啊,我用的是5,
dageming 2001-07-19
  • 打赏
  • 举报
回复
lianghn(宁河)
我很喜欢注册DLL的,每天睡觉之前我都要把系统的里DLL全都注册一遍,就象刷牙一样,呵呵

hz1101 2001-07-19
  • 打赏
  • 举报
回复
在工程窗口中在类的名字上点一下(不是工程名),下面属性窗口会自动显示一些内容,instancing默认状态值是1,你可以将它设为6
dageming 2001-07-19
  • 打赏
  • 举报
回复
TO  hz1101(我学!我学!!我学!!!...) 
哪个instancing?我只有一个类模块,其实我还是不清楚你的意思,NND,小时候测智商我可是146啊,真是典型的小时了了,:)
lianghn 2001-07-19
  • 打赏
  • 举报
回复
老大,是你没有将DLL注册吧?!
dageming 2001-07-19
  • 打赏
  • 举报
回复
to hz1101(我学!我学!!我学!!!...) 
什么设置值?
TO red_eyes(红眼睛)
VC俺不会,现在我唯一知道的是肯定是哪里出现了一点点的偏差(废话)
hz1101 2001-07-19
  • 打赏
  • 举报
回复
我认为是instancing的设置不对,贴出来看看,看你选中的是不是1或2,若是,那你的问题就找到了!
red_eyes 2001-07-19
  • 打赏
  • 举报
回复
改用VC试试,应该是通用的接口或是标准的问题。
hz1101 2001-07-19
  • 打赏
  • 举报
回复
顺带将DLL中各类的instancing的设置值给出来
dageming 2001-07-19
  • 打赏
  • 举报
回复
是在一开始声明的时候出错,我还没开始调用里面的东东呢
以下是类模块:

Private mvarGeometry As IGeometry
Private mvarLayer As IFeatureLayer
Private mvarDisplay As IScreenDisplay
Private mvarMap As IMap
Private mvarView As IActiveView
Private mvarParent As Form
Private mvarOledb_Tab As Boolean
Private mvarField As String
Private mvarConnection As


Public Property Let Field(ByVal vData As String)
mvarField = vData
End Property


Public Property Get Field() As String
Field = mvarField
End Property


Public Property Let Oledb_Tab(ByVal vData As Boolean)
mvarOledb_Tab = vData
End Property


Public Property Get Oledb_Tab() As Boolean
Oledb_Tab = mvarOledb_Tab
End Property


Public Property Set Parent(ByVal vData As Object)
Set mvarParent = vData
End Property


Public Property Get Parent() As Object
Set Parent = mvarParent
End Property


Public Sub Show(Optional pos_Top As Long, Optional pos_Left As Long)
Set frmIdentify.Map = mvarMap
Set frmIdentify.View = mvarView
Set frmIdentify.Display = mvarDisplay
frmIdentify.Table = mvarOledb_Tab
frmIdentify.Field = mvarField
frmIdentify.Connection = mvarConnection


If SelectObjectsInDisplay(mvarGeometry, mvarMap, mvarLayer) Then
If Not IsMissing(pos_Top) Then
frmIdentify.Top = pos_Top
End If
If Not IsMissing(pos_Left) Then
frmIdentify.Left = pos_Left
End If
frmIdentify.Show
End If

End Sub


Public Property Set View(ByVal vData As IActiveView)
Set mvarView = vData
End Property


Public Property Get View() As IActiveView
Set View = mvarView
End Property


Public Property Set Map(ByVal vData As IMap)
Set mvarMap = vData
End Property


Public Property Get Map() As IMap
Set Map = mvarMap
End Property


Public Property Set Display(ByVal vData As IScreenDisplay)
Set mvarDisplay = vData
End Property


Public Property Get Display() As IScreenDisplay

Set Display = mvarDisplay

End Property


Public Property Set Layer(ByVal vData As IFeatureLayer)
Set mvarLayer = vData
End Property


Public Property Get Layer() As IFeatureLayer
Set Layer = mvarLayer

End Property


Public Property Set Geometry(ByVal vData As IGeometry)
Set mvarGeometry = vData
End Property


Public Property Get Geometry() As IGeometry

Set Geometry = mvarGeometry

End Property

Public Property Set Connection(ByVal vNewValue As Connection)
Set mvarConnection = vNewValue
End Property

Public Property Get Connection() As Connection
Set Connection = mvarConnection
End Property
little_hero 2001-07-19
  • 打赏
  • 举报
回复
调用方法或传递参数有问题!最好给出源代码,以供讨论!

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧