Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

VB Runtime error 5

9 views
Skip to first unread message

DPM

unread,
Oct 16, 2005, 5:51:09 PM10/16/05
to
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.
--
Regards,
Dean


Someone

unread,
Oct 16, 2005, 6:20:50 PM10/16/05
to
> 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.


"DPM" <d...@junk.com> wrote in message
news:u63MXvp0...@TK2MSFTNGP12.phx.gbl...

Someone

unread,
Oct 16, 2005, 6:46:29 PM10/16/05
to
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.


"Someone" <nob...@cox.net> wrote in message
news:eQB6c$p0FHA...@tk2msftngp13.phx.gbl...

Phill. W

unread,
Oct 17, 2005, 8:01:58 AM10/17/05
to
"DPM" <d...@junk.com> wrote in message
news:u63MXvp0...@TK2MSFTNGP12.phx.gbl...

> 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).

that fact that you're getting Runtime Error #5 rather than some more
nasty (like a memory violation) suggests that your VB code is failing,
rather than anything that might be "underpinning" it.

Are you searching a string read from the operating system based on
some delimiter and then using this result to "slice up" the string? as in

i = Instr( sFromSystem, "-" )
sPrefix = Left$( sFromSystem, i - 1 )

If the given delimiter /doesn't/ appear in the string, the above will fail
(because you can't index into a string from position -1).

HTH,
Phill W.


DPM

unread,
Oct 17, 2005, 1:31:14 PM10/17/05
to
Solved it. Turns out German language support got included somehow, and this
screwed up some date string processing.

Thanks for your suggestions.

Dean

"Someone" <nob...@cox.net> wrote in message

news:eOiVyNq0...@TK2MSFTNGP15.phx.gbl...

0 new messages