C# COM Component works with VB6, but not VB5 -- What's Up With This?
In an earlier question I was attempting to get a C# class functioning as a COM object for VB5 & 6. I did manage to get the COM object working with a VB6 app, but have had a problem getti开发者_开发问答ng it work with VB5 -- on the same machine.
For reference, the earlier question is HERE.
My ultimate goal is to get this COM object working for VB5, but when it runs it throws an exception: Runtime Error 80070002. Research on Stackoverflow indicates HERE that this error code is a File not Found exception. The VB6 program is able to run on the same machine as the VB5 program (identical code), the COM DLL is properly registered (using regasm.exe) and the TLB shows up in the list of references in VB5. The executing code is:
Dim arcom As ARCOMObject.ARCOM_Class
Set arcom = New ARCOMObject.ARCOM_Class
Dim s As String
s = arcom.GetServiceResponse()
MsgBox (s)
The exception is thrown upon execution of the line instantiating the class.
In other places I have found, especially in the second SO reference I have made above, a suggestion has been made to use the utility depends.exe to see what dependency might be missing. Unfortunately, I am unable to find any such utility, neither on my .Net dev machine, nor on the VB5 machine. I'm not sure if this would tell me anything anyway, but...
So, what can't VB5 see, that VB6 either can see or doesn't need?
EDITED TO ADD:
Important Caveat -- Because it threw the error while being run from the IDE I never built the executable to run it, but when I finally took a shot and did so because DependencyWalker needs it, I found the executable itself worked OK! Now, DependencyWalker gives me the message "Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module." Wow, that's cool, what on earth does this sentence mean? LOL.
Anyway, I'm not sure that I have a problem that needs solving at the moment, but any suggestions are welcomed!
Here is what always works for me when I am stuck resolving these types of issues. Your issue is that the VB5 version is missing a file somewhere down the line, so you need to know which one. The easy solution (without resorting to WinDBG) is to throw FileMon or ProcMon - filter it so that you only see failures.
Then when your app fails, you'll see which file was missing.
this might be interesting: At least one module has an unresolved import due to a missing export function in an implicitly dependent module
精彩评论