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

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

Post by Bob Evan » Wed, 17 Sep 2003 23:02:06


I have a VB 6.0 application that receives Run-time error 430 when installed
on one NT 4.0 SP6a workstation, but not on another that should be configured
identically (but obvisously is not). I realize that this is most likely due
to a specific object being the wrong version (possibly ADO).

How do I determine what Class is being referenced in the Visual Basic app
without installing the development environment on the problem machine?
 
 
 

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

Post by Ken Halte » Wed, 17 Sep 2003 23:14:43

> How do I determine what Class is being referenced in the Visual Basic app

Error trapping.... we use something like this....
'============
Private Sub Command1_Click()
Const ErrorLocation = "Form1:Command1_Click"
On Error GoTo ErrorTrap
'******************************
Dim sObject As String
Dim o As YourClass 'set this = your class name

sObject = "YourClass" 'set this = your class name
Set o = New YourClass 'set this = your class name

'******************************
Terminate:
Exit Sub

ErrorTrap:
If Err.Number = 91 Or (Err.Number > 428 And Err.Number < 439) Then
Err.Description = ErrorLocation & " - Attempted to create or reference an instance
of " & sObject & " object, VB responded with '" & Err.Description & "'"
End If
MsgBox "Error " & Err.Number & vbCrLf & Err.Description
Debug.Assert False 'Stops here in the IDE
Resume Terminate
Resume
End Sub
'============

Once you run through it once, unregister the component and run again... you should end up
with a msgbox that reads...

Form1:Command1_Click - Attempted to create or reference an instance of YourClass object,
VB responded with 'ActiveX component can't create object'

--
Ken Halter - MS-MVP-VB - http://www.yqcomputer.com/
Please keep it in the groups..

 
 
 

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

Post by Bob Evan » Thu, 18 Sep 2003 00:00:31


Any thoughts on identifying the class without recompiling?

What about without modifying the source?

If source modification is necessary, what about doing this without
duplicating the class name as both a string literal and class reference?

Thanks,
Bob




app
reference an instance
you should end up
YourClass object,


installed
configured
due
app
 
 
 

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

Post by Ken Halte » Thu, 18 Sep 2003 00:25:41

It's really unfortunate that the error message doesn't already include the cause of the
error. The OS knows what caused the error.... why not give us a hint.

There is no way to identify the source of the error without strings... unless, I guess you
could add line numbers (ick) and check Erl when the error is raised.

The good news is... that entire routine (the error trapping part) was written with a
single keystroke. I use CodeSmart 2003 ( http://www.yqcomputer.com/ ) (have been using CodeSmart
since v3.5). I'm not sure but I think mztools (free) will do things like this too
( http://www.yqcomputer.com/ )

The bottom line is... there's no substitute for decent error trapping.

Here's a product that'll pay for itself quickly if used correctly. You can feed it your
source and it'll generate a new project that contains that source plus *extensive* error
trapping... even traps the good old (worthless) Dr. Watson. When an error is raised, you
can set an option to have the utility email you the contents of every
variable/property/everything else. Plus, you can trace compiled apps.

VB Watch v2
http://www.yqcomputer.com/

--
Ken Halter - MS-MVP-VB - http://www.yqcomputer.com/
Please keep it in the groups..
 
 
 

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

Post by Bob Evan » Fri, 19 Sep 2003 02:55:11

I did some more reading and it would seem like the string specified for the
class name could also be used for the creation reference, similar to:

sObject = "YourClass" 'set this = your class name
Set o = CreateObject( sObject) 'set this = your class name

That would eliminate the redundant class name. It would also possibly lend
itself to create a MyCreateObject() func that accepted
filename/funcname/etc.

Does the 430 error come about at instantation (as a result of the New or
CreateObject()) or can it come after creation when a specific method or
property is referenced?

Documentation indicates that early binding is still performed when using the
CreateObject(). What is sacrificed by using CreateObject() in place of New
keyword.

Thanks,
Bob





cause of the
unless, I guess you
written with a
using CodeSmart
this too
feed it your
*extensive* error
is raised, you
 
 
 

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

Post by Jens Neuha » Fri, 19 Sep 2003 03:29:27

i Bob,

I always use a wrapper function:

public function ACCreateObject(byref sProgID as string, _
optional byref server as string="") as _
Object
on error goto err_H
set AcCreateObject = CreateObject(sProgID, server)
exit function
err_H:
err.Raise err.Number, _
err.Source & "/AcCreateObject:" & sProgID & "@" & server

end function


(our errorhandler looks different but that doesn't change the idea)

The performance penalty is not _that_ big, especially if you only call
it a few times. (and I am not sure if vb does some caching on its behalf
like ProgID -> ClassFactory)

Jens


Bob Evans wrote:


 
 
 

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

Post by Ken Halte » Fri, 19 Sep 2003 04:36:58

Error 430 usually rears it's ugly head when interface signatures don't match. After a
component is compiled, it relies entirely on IIDs to find methods/properties. Even though
a component may have a property named "GetDate" and you're calling "GetDate", it may not
be found if the IIDs have been changed... Also, it may find that GetDate method but since
it has a different IID, VB'll raise the error 430.

Within your own components, you can prevent this by always keeping your binary compatible
components up to date... They must contain all publics or you're gonna get errors in the
range of 429-438.

Your "MyCreateObject()" method can be used to instantiate all of your objects and trap the
errors there (I believe this was a VBPJ tip at one time).

--
Ken Halter - MS-MVP-VB - http://www.yqcomputer.com/
Please keep it in the groups..
 
 
 

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

Post by Kingbarry2 » Tue, 23 Sep 2003 16:24:10


installed
configured
due

1) On the compiling machine, browse the vbp and note the references and
classes.
2) Go to each (dll) and right click -> property->version
3) Write this down
4) Go to problem machine, do steps 2 & 3
this should resolve your problem, unless:

If you are creating controls ( ocx ), activex, etc. You should be using
BINARY compatibility.

Investigate error handling tools.

line numbering in VB is essential for the final build.

each function/subroutine should look like:



'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@
'@ oBLKAVLTree DateTime: 9/16/2003 09:27 Author: Barry L. King
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@
Public Function GetCurrent(ByRef vData As Variant) As Boolean

Const sProcedure As String = "GetCurrent"

On Error GoTo ExitError

If moNodeCurrent Is Nothing Then
GetCurrent = False
Else
vData = moNodeCurrent.vData
GetCurrent = True
End If

ExitOK:

Exit Function

ExitError:

Call goError.SetError("BLKAVLTree.oBLKAVLTree", "GetCurrent", Err.Number,
Err.Description, Erl, BLKErrorSeverityUnknown, True)
End Function


MXTools is FREEWARE / DONATEWARE and excellent. Will automate all the above.
 
 
 

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

Post by Bob Evan » Wed, 24 Sep 2003 06:42:32

Thanks for the info all.

I located our copy of NuMega DevStudio and used the FailSafe component to
add the line numbers and error trapping code. Once the project was rebuilt I
ran on the problem workstation and quickly identified it was due to an older
version of a system DLL than was used for the build.

While NuMega FailSafe worked great, does anyone know if there is a batch or
command line oriented tool that runs without requiring user interaction. I
would prefer to add this to a build process so that it is always present in
the production code, but doesn't increase the maintenance of source by
requiring developers to work with line numbers.





match. After a
methods/properties. Even though
"GetDate", it may not
method but since
binary compatible
errors in the
objects and trap the


the
lend
the
New
 
 
 

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

Post by Ken Halte » Wed, 24 Sep 2003 23:07:34

BWatch can add extensive error traps. It creates a copy of your source, adds the error
handling and compiles that version. Your original is untouched. It's actually pretty cool.
Just wish our budget would allow us to buy it. I may just buy it myself. It's not that
expensive.

VBWatch
http://www.aivosto.com/vbwatch.html

--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
Please keep it in the groups..

"Bob Evans" < XXXX@XXXXX.COM > wrote in message
news:c1Kbb.407879$Oz4.199063@rwcrnsc54...