VB Runtime error 5

  • Thread starter Thread starter DPM
  • Start date Start date
D

DPM

Hello,

We've written an application in VB6 we intend to run on XP SP1 embedded. We
compile the application and package it. If we install and run it on XP pro
SP1 it runs correctly, but on XPe we get a "Runtime error 5" (invalid
procedure call or argument). We've isolated to a string function (LEFT,
MID, RIGHT or INSTR). Curiously, if we build the XP Pro emulation on
embedded we don't see the problem, so we can only assume that we're missing
a component.

So the $64K question is: what XP component would be used to handle string
functions? It must be part of the basic OS if the VB6 packager does not
include it. Is there a tool we could use to isolate the dll or control that
does string management?

Any help appreciated. Thanks.
 
So the $64K question is: what XP component would be used to handle string
functions?

MSVBVM60.DLL

Add error handling to your code. Here is how to show which routine and line
if you can't run the IDE in the target system.

- Download and install MZTools:

http://www.mztools.com/v3/mztools3.htm

- Go to MZTools Options|Error Handler, and paste the following(unwrap as
needed):

On Error GoTo {PROCEDURE_NAME}_Error

{PROCEDURE_BODY}

ExitMe:
On Error GoTo 0
Exit {PROCEDURE_TYPE}

{PROCEDURE_NAME}_Error:

MsgBox "{MODULE_NAME}:{PROCEDURE_NAME}:" & ErL & vbCrLf & "Error " &
Err.Number & ": " & Err.Description
Resume ExitMe

- The above would show a message like:

Form1:Form_Load:110
Error 5: Invalid procedure call or argument

- Backup your source files in case you want to remove these additions
quickly.

- Go to every form and routine and add an error handler by clicking on the
icon on the tool bar. Add line numbers to each routines as well, which is
another button in MZTools toolbar.
 
You could find related DLL files by going to View|Object Browser(F2).
Maximize the window, then search for the function name and see what library
it's included in. For example, searching for "mid" shows that it's in "VBA"
library. To find the DLL name for "VBA" library, select "VBA" from the
dropdown list on the upper left. At the bottom, you will see what's the DLL
file name for "VBA" library. In my case, it shows
"C:\WINDOWS\system32\msvbvm60.dll".

Adding error handling to everywhere in your code helps in finding where the
problem is. You probably have error handling in places where you expect the
errors to be, but in this case it was not enough.
 
Solved it. Turns out German language support got included somehow, and this
screwed up some date string processing.

Thanks for your suggestions.

Dean
 
Back
Top