-
May 15th, 2017, 01:27 PM
#1
Thread Starter
New Member
ActiveX Exe Throwing Type Mismatch 13 Error
Greetings,
I have an ActiveX exe component that is getting called by a stand alone exe, both were developed in VB 6.0. The component is throwing a "type mismatch" 13 error.
Here is an excerpt of the code where the ActiveX exe is being declared and instantiated in the program:
Code:
.
.
.
Const errSUMMARY = 9310
Dim Msg_Summary As CDBSReport '<-- implements CDBSReport
Dim Report_Settings As CDBSReports.rptSummary
Dim First_Page As Integer
On Error GoTo ErrorHandler
First_Page = Page_Number
'Determine the size of the margins for the current page
With Word_Document.Sections(Word_Document.Sections.Count).PageSetup
Top_Margin = IIf(.Orientation = wdOrientPortrait, .TopMargin, .RightMargin)
Bottom_Margin = IIf(.Orientation = wdOrientPortrait, .BottomMargin, .LeftMargin)
End With
Set Msg_Summary = New CDBSReports.rptSummary '<--- error occurs here, rptSummary implements CDBSReport
.
.
.
When the class gets instantiated, it throws a "type mismatch 13" error. Setting a breakpoint in the component class, I can see it run the initialization method without any errors. Then, it goes right into the terminate method. No errors appear to be thrown in the component. I can't see where the problem is. There are many classes in this ActiveX compoment that implement CDBSReport, and they all throw the same mismatch error when called.
This code has worked for a long time, and none of the class names or method names have changed. I recently made a change to one of the dlls that this component and the stand alone uses. One of the parameters in a particular method was changed from an integer datatype to a long datatype. I have ensured that the correct datatypes are being passed in. I have spent many hours recompiling everything and still this error occurs. We are running this in a Windows 2008 R2 environment.
What could be wrong here? How do I debug this?
Many thanks.
Last edited by Freedom123; May 16th, 2017 at 05:14 AM.
Reason: for clarity
-
May 15th, 2017, 02:07 PM
#2
Re: ActiveX Exe Throwing Type Mismatch 13 Error
Your code is wrong, because you had first declared Msg_Summary as CDBSReport, while:
a - Msg_Summary isn't a CDBSReport.rptSummary object.
b - Msg_Summary IS a CDBSReport object.
-
May 16th, 2017, 05:03 AM
#3
Thread Starter
New Member
Re: ActiveX Exe Throwing Type Mismatch 13 Error
Hi Gibra, actually, the class rptSummary implements CDBSReport. So I believe the code is good. I should have been more clear about that.
Thanks.
-
May 16th, 2017, 07:29 AM
#4
Thread Starter
New Member
Re: ActiveX Exe Throwing Type Mismatch 13 Error
I thought I would get more coverage that way. Do I need to delete one of them?
-
May 16th, 2017, 07:33 AM
#5
Re: ActiveX Exe Throwing Type Mismatch 13 Error
But the rptSummary isn't in the CDBSReport is it?
Actually... maybe the question I should be asking is this: are you sure you have that right? Use of the word "Implements" has a very specific meaning. What I hear you saying is that CDBSReport is an Interface that rptSummary then Implements.
Like so:
Code:
Interface ICar
Public Sub StartEngine()
Public Sub StopEngine()
Public Function SoundHorn() as Boolean
End Interface
THAT is an example of an Interface.
That interface is then implemented:
Code:
Public Class MyCar
Implements ICar
Public sub StartEngine() Implements ICar.StartEngine
'Code goes here
End Sub
Public Sub StopEngine() Implement ICar.StopEngine
'Code here
End Sub
Public Function SoundHorn() as Boolean Implements ICar.SoundHorn
'And more code here
End Function
End Class
So, is that really the case you have here? Something tells me that's not the case.
-tg
-
May 16th, 2017, 07:38 AM
#6
Re: ActiveX Exe Throwing Type Mismatch 13 Error
No... it just needs to be reported to the admins... which has now been done... Besides us mere mortals can't delete threads. Not even the demi-god moderators can... and the Admins tend to not want to delete things for historical reasons. Odds are they'll be merged into one thread.
-tg
-
May 16th, 2017, 08:04 AM
#7
Re: ActiveX Exe Throwing Type Mismatch 13 Error
Look at your two Dim statements then the set statement where your error occurs the problem seems pretty obvious
-
May 16th, 2017, 08:15 AM
#8
Re: ActiveX Exe Throwing Type Mismatch 13 Error
... and none of the class names or method names have changed... One of the parameters in a particular method was changed from an integer datatype to a long datatype.
Changing parameters can break binary compatibility which may have been done? If this is the case, never change the signature of a function when binary compatibility matters. Kinda do what others do: create a new function with Ex or incremental ordinal, i.e., GetOSVersionEx, NewWindow2, etc
-
May 16th, 2017, 08:17 AM
#9
Thread Starter
New Member
Re: ActiveX Exe Throwing Type Mismatch 13 Error
Greetings, thank you for the replies. The rptSummary class implements the CDBSReport class. The public properties in the CDBSReport class are implemented in the rptSummary class. In the rptSummary class we have:
Implements CDBSReport
This code has not been changed and has worked before.
-
May 16th, 2017, 08:26 AM
#10
Thread Starter
New Member
Re: ActiveX Exe Throwing Type Mismatch 13 Error
LaVolpe, I have wondered if this might be part of the problem because I did change the signature on a function in a component that is used by CDBSReport. But I did recompile everything... shouldn't that take care of it? Maybe I didn't do in the right order. Are there some guidelines for compiling components, such as what the correct compiling order should be and what the settings should be?
Thank you
-
May 16th, 2017, 09:07 AM
#11
Re: ActiveX Exe Throwing Type Mismatch 13 Error
Not sure exactly how your components were recompiled. If ComponentXYZ was recompiled after changing its parameter from Integer to Long, then ComponentABC that references ComponentXYZ would need to remove the old reference and add the new reference (VB Project References). It might be as simple as that? It does sound like this could be the reason for your mismatch: passing Long to previously registered reference that is still using Integer?
Edited: Maybe breaking binary compatibility isn't the problem as I'd imagine a different error that "type mistmatch". And when recompiling stuff, if you didn't get any warnings from VB about breaking compatibility, especially after changing a public method's parameter, I'm guessing binary compatibility wasn't in play? Here's a short how-to regarding binary compatibility but doesn't discuss complex, multi-component projects.
Last edited by LaVolpe; May 16th, 2017 at 09:13 AM.
-
May 16th, 2017, 09:13 AM
#12
Thread Starter
New Member
Re: ActiveX Exe Throwing Type Mismatch 13 Error
Yes, that sounds like the situation. I didn't change the name of the component after I recompiled it, and I didn't change reference. Do I need to explicitly remove the old reference then add it back in?
-
May 16th, 2017, 09:15 AM
#13
Re: ActiveX Exe Throwing Type Mismatch 13 Error
I modified my previous reply while you were adding your last one.
I'd try that first, but is it possible you have multiple versions now, same name? Should the previous one have been unregistered before the new was compiled? Hopefully this isn't a start into DLL-hell for you.
-
May 16th, 2017, 09:24 AM
#14
Thread Starter
New Member
Re: ActiveX Exe Throwing Type Mismatch 13 Error
Thank you LaVolpe. I suspect we may have multiple versions going on. Now I have some things to try. Thank you for the guidance. I'll post the results when we get there.
-
May 16th, 2017, 10:30 AM
#15
Re: ActiveX Exe Throwing Type Mismatch 13 Error
You do get more coverage from multiple threads in different forum, but as a policy, we don't like that so much, as it tends to end in confusion, as answers in one thread may or may not match with answers in different threads. Therefore, we merge, close, or delete duplicate threads. Mods can delete threads and individual posts. At one point, any user could do the same, which resulted in the demise of a very interesting thread when the original poster deleted the original post....which deleted the whole thread. It wasn't a good thread, so I understand their actions, but it sure was interesting.
My usual boring signature: Nothing
-
May 16th, 2017, 11:02 AM
#16
Thread Starter
New Member
Re: ActiveX Exe Throwing Type Mismatch 13 Error
OK, thank you for the information. I will keep that in mind for the future.
-
Jun 5th, 2017, 06:43 AM
#17
New Member
Re: ActiveX Exe Throwing Type Mismatch 13 Error
Look at your two Dim statements then the set statement where your error occurs the problem seems pretty obvious
-
Jun 5th, 2017, 06:57 AM
#18
Thread Starter
New Member
Re: ActiveX Exe Throwing Type Mismatch 13 Error
Does it? Maybe you could elaborate.
-
Jun 6th, 2017, 06:15 PM
#19
Re: ActiveX Exe Throwing Type Mismatch 13 Error
Looks like he simply copied and pasted my post from earlier
Your dim statement shows
Code:
Dim Msg_Summary As CDBSReport
but then your set statement shows something else
Code:
Set Msg_Summary = New CDBSReports.rptSummary
apparently those are two different types hence the type mismatch
Meanwhile you have
Code:
Dim Report_Settings As CDBSReports.rptSummary
So I would guess that if that set line were to read
Code:
Set Report_Settings = New CDBSReports.rptSummary
or
Code:
Set Msg_Summary = New CDBSReport
Then there would not be a type mismatch thrown
-
Jun 7th, 2017, 05:14 AM
#20
Thread Starter
New Member
Re: ActiveX Exe Throwing Type Mismatch 13 Error
Greetings, thank you for the reply. CDBSReports.rptSummary implements CDBSReport. CDBSReports is an ActiveX out-of-process server and the class rptSummary implements CDBSReport.
I just discovered the problem. It was because the class id's got messed up in the registry. I totally cleaned out the registry of everything related to this project and then recompiled everything, that did the trick. LaVolpe was definitely on the right track. I appreciate everyone's responses.
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|