Solved

Run-Time Error '5' invalid procedure or argument

Posted on 2002-06-13
41
22,264 Views
Last Modified: 2011-08-18
A fellow Moderator here created an excellent tool for the Mod team which helps us quickly query the database and find open and locked questions at a userid level so we can post scripts and begin the follow-up process in the cleanup effort.  He is unavailable for a while and I need some help quickly, so your "comments" are appreciated very much.

The API worked flawlessly until I upgraded from W98SE to Windows XP.  I've modified the registry, moved pertinent .ocx files to the proper directory, downloaded VB6 SP5 runtime and installed it, yet the problem persists.  I also modified the API (exe) to run in Windows 98 Compatibility mode, but nothing has fixed the problems I list below:

Query the database (uses Power Search) for MemberIDs I know have open Qs, but the results return as zero found, that's problem one.

Query the database for PAQ items, get results, but can't access; get an immediate response saying:
"Run-Time error '5':  Invalid procedure call or argument"
Then the application shuts down.

Found many hits and bugs by others searching MSDN and MS, most said this was a bug in VB5, fixed in VB6.  Since I updated my VB runtime, should have been fixed (one would think), but apparently not.

Thanks for your helpful comments.

Moondancer - EE Moderator
0
Comment
Question by:Moondancer
  • 18
  • 15
  • 4
  • +3
41 Comments
 
LVL 1

Author Comment

by:Moondancer
Comment Utility
I did find this on the Net, saying:
If you are getting "runttime error 5" "invalid procedure call or argument" and you are running Windows XP. You need this file riched32.dll (right click on the file name and choose "Save target as") and place them in your Windows system folder (usually C:\WINDOWS\SYSTEM).

But can't save it; try saving target as and only get the option to save register.htm
0
 
LVL 15

Expert Comment

by:ameba
Comment Utility
http:Q.20294299.html
andreouellet solved problem by adding DoEvents before SetFocus:

>But with the line "DoEvents" before the line "cmbRapport.SetFocus" the problem disappear

          DoEvents    'Problem disappear ???
          cmbRapport.SetFocus
0
 
LVL 1

Author Comment

by:Moondancer
Comment Utility
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/CommCtls/richedit/richeditcontrols/aboutricheditcontrols.asp

This MSDN link shows that Windows XP already has riched32.dll... but still the problem persists.
0
 
LVL 1

Author Comment

by:Moondancer
Comment Utility
Hi, Bruno, thanks a bunch.

Sorry to be dense, but I know little to nothing about VB and VB Controls.  Does this mean I have to recode and recompile?  If so, I'm clueless.

I'll check the Q you list above.
0
 
LVL 15

Expert Comment

by:ameba
Comment Utility
There are many possible causes for that error - without code you cannot do much.

>Query the database (uses Power Search) for MemberIDs I know have open Qs, but the results return as
zero found

I tried Power Search today and it doesn't work:
search for "button" (which is mentioned very often, btw) in VB topic area, in last 180 days and there were 0 matches.
0
 
LVL 1

Author Comment

by:Moondancer
Comment Utility
True, Power Search results have been intermittent.  But I only used queries that I manually tested in realtime first for userIDs that returned results but the API returns none.  Maybe it's a Power Search problem.

I then tried the query for PAQ for Moondancer, and since I have over 3,000 in my PAQ, the screen did begin to produce visible results but then returned this error 5.  Do you suppose that the error could result just due to sheer volumes trying to be handled?

I'm truly baffled and most appreciative of your help.

I have the EXE, is that what I'd try to modify?  Remember, I'm clueless on the programming side of things.

:) Moondancer - EE Moderator
0
 
LVL 1

Author Comment

by:Moondancer
Comment Utility
Could the runtime 5 error ever be a 'time out' kind of event?
0
 
LVL 15

Accepted Solution

by:
ameba earned 300 total points
Comment Utility
You cannot modify EXE, you must have source code.

Or you can tell me what app does:
you enter username and it gives open questions? In which format?
Or does it automatically post something to each question?
0
 
LVL 15

Expert Comment

by:ameba
Comment Utility
>Could the runtime 5 error ever be a 'time out' kind of event?
It can be anything.
0
 
LVL 1

Author Comment

by:Moondancer
Comment Utility
Also moved a key .ocx files into the windows directory, and found the same file in the windows\system32 directory, could that be a problem?
0
 
LVL 1

Author Comment

by:Moondancer
Comment Utility
I'm getting ZERO notifs, Engineering advised, so watching this Q realtime.  Closed it so we can keep this streamlined and work on it together with minimum disruption.

It can autopost the Abandoner script, the function was included, but I'm only using it in basic mode now.  What it does is logs me in as a Moderator to access the Administrative functions.  Once logged in there is an OpenQ exe and the other for PAQs.  The only one I critically need (until Tuvok returns) is the OpenQ function.  I key in the Member ID and say GO... the API invokes Power Search for all Open and Locked Questions for that Member ID and imports the results into the API where I can then take direction actions to close the items.  That part is "broken", it never pulls in any results, and I do not get a runtime 5 error for that, I just get zero results (no open questions), which is in error.

Sorry for the confusion here, but I thought the PAQ module runtime error 5 "may" play a part in the empty results on the OpenQ module.

Let me know what else I should be telling you.  Or should I send you the ZIP file of the API package, would that help?

Thanks so much.
0
 
LVL 1

Author Comment

by:Moondancer
Comment Utility
BTW, I do have riched32.dll in the windows\system directory, and it is version 5.1.2600 Wrapper Dll for Richedit 1.0
0
 
LVL 15

Expert Comment

by:ameba
Comment Utility
I don't think you can do anything without source - if any OCX is missing you'll get different error.

The programmer must find the line and procedure which gives the error...

Thanks for the grade  :-)

It seems app does more than just reading open and locked questions.
I can read/parse profile, and output those questions, but it seems that is only part of the story...

And I'm not moderator, so API's wouldn't work, I think...
0
 
LVL 15

Expert Comment

by:ameba
Comment Utility
My e-mail is in my profile, I can have a look if you send me something...
0
 
LVL 1

Author Comment

by:Moondancer
Comment Utility
Thank you, sending now.
0
 
LVL 1

Author Comment

by:Moondancer
Comment Utility
It is an incredibly excellent API and tuvok put tons of creative energy and work into designing it for us, I was the official tester. It does so much more than I can even begin to relate, I am the idea person and 100% clueless about the complexity and magic that Tuvok worked to bring the tool into being.  He is always and has always been there for me when I encounter roadblocks, but this roadblock has been here for me since I upgraded and my productivity is seriously degraded.  If he were available, he'd have fixed it for me without a doubt, as he's fixed others before.  I appreciate your help very much, and wish I could tell you more of the details.  Hopefully he'll return soon and see my pleading Email and this link.
0
 
LVL 15

Expert Comment

by:ameba
Comment Utility
Thanks, I'm receiving it... I'll check it and see if I can do something...
0
 
LVL 15

Expert Comment

by:ameba
Comment Utility
I extracted one zip file (there are other files, but utility to extract from "tnef" doesn't work good) and installed ModTools.

I'm also receiving Run-Time error '5', so it has nothing to do with XP.  I think format of the page with search results changed, and program cannot parse/read that page.

My program also stopped working last week because of changed links.
It will be simple for programmer to change program to recognize underscore in question links.
0
 
LVL 15

Expert Comment

by:ameba
Comment Utility
Summary:

Links have been changed on 5 (or 6) June 2002
Before, we had dot "." between Q and question number, e.g. Q.20311459.html
Now, it's underscore "_" e.g. Q_20311459.html

I changed my program QuickPost, to read question lists with new links, in 30 minutes.
Tuvok will have to do the same with his program.

--------------------
Moving files riched32.dll or some OCX-es to different directory won't help.
--------------------
It has nothing to do with XP, since the same problem "Runtime error 5" is on my Win95 system.
So, going back to Win98 from XP won't help.
--------------------

I cannot change Tuvok's program, because I do not have source code.

--------------------
I can create new program which can read PAQs or opened and locked questions.
But, this is not useful for you - since you need automatic posting, and that (automatic posting) is the part which I didn't try and I would need time to create/test that functionality.
--------------------
0
 
LVL 1

Author Comment

by:Moondancer
Comment Utility
YOu've done plenty by helping me understand the programming changes to the QID format (wish I misssed completely), and thank you very much.  You more than earned these points.  I'll send this link to Tuvok and, again, thank you.

:) Moondancer - EE Moderator
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 15

Expert Comment

by:ameba
Comment Utility
Thanks again for the points and grade!

Bruno
0
 
LVL 1

Author Comment

by:Moondancer
Comment Utility
Thanks to you, Bruno for all your help over and above "the call of duty", so to speak.

I'm still getting no Email notifs, quite frustrating.

But smiling anyway.

:)
0
 

Expert Comment

by:Tuvok
Comment Utility
Hi guys!

Bruno, thanks for covering for me ;-)

The format of the search page is changed, as Bruno suggested. Since ModTools still is in beta version, I did not include all error handling.
This is an easy fix. Hope to come to it within a couple of days. But as you know Moonie, I don't have internet access all the time ... :(

Live long and prosper.
Best regards my friends,
Tuvok
0
 
LVL 15

Expert Comment

by:ameba
Comment Utility
Thanks, Tuvok.  It's a nice and useful program.  Good work!

Bruno
0
 
LVL 1

Author Comment

by:Moondancer
Comment Utility
I LOVE IT!  Thank you thank you thank you.

Still no fix for the Moondancer@experts-exchange.com notifs (since 6/12), and many have since been purged.  Very sad.

Oh well, as always, I'm in deepest appreciation mode to you both.

Tuvok's tool is the most excellent tool I've used (API) in all the years I've used APIs to automate redundant processes, and he's been here for me in all regards to fix things and/or further enhance the program.  I just can't find enough words of praise and appreciation for all that he has done for our team here.

:) Moondancer - EE Moderator
0
 

Expert Comment

by:Tuvok
Comment Utility
:"> Thanks Moonie! I'm blushing!

Bruno, if you like, you can have the source code.
Just mail me.... You know my addy (just look in the help of ModTools).

T

0
 
LVL 1

Author Comment

by:Moondancer
Comment Utility
COOL, great.  Blushing is good.  ;)
Finally got Email from 6/17 onward, prior time, gone (so far).  Boo hoo.
Thanks,
Moondancer - EE Moderator
0
 
LVL 15

Expert Comment

by:ameba
Comment Utility
Thanks, Tuvok.
If the tool isn't updated yet, I can try updating it to new type of links - in that case, please, send me the source;  my e-mail is in my profile, or I think it's also in you address book (as Bruno Paris)
0
 

Expert Comment

by:Tuvok
Comment Utility
Bruno, I will send you the source a.s.a.p.
(indeed I have your personnal addy...)

I know you can fix it also. Thanks!

T
0
 
LVL 15

Expert Comment

by:ameba
Comment Utility
OK. Thank you!
0
 
LVL 1

Author Comment

by:Moondancer
Comment Utility
HUGS and thanks. :)
0
 
LVL 1

Author Comment

by:Moondancer
Comment Utility
Hi, ameba.

I know Tuvok has had Internet access roadblocks, and probably why you haven't yet received the source code.

Moondancer - EE Moderator
0
 
LVL 15

Expert Comment

by:ameba
Comment Utility
OK.  No problem.  :-)
0
 
LVL 15

Expert Comment

by:ameba
Comment Utility
Hi, all
I received source files and changed "Q." to "Q_" and it seems reading now works.

I don't know if any other function is not working...

Exe file (zipped) sent to Moondancer for test...
0
 

Expert Comment

by:Tuvok
Comment Utility
Great!
Thanks Bruno!!

T
0
 
LVL 1

Author Comment

by:Moondancer
Comment Utility
Thank you so much, Tuvok and ameba.  Works fine, no problems; we love Tuvok's tool, it makes our productivity so much better.  Your help in dealing with the reformatted URL "roadblock" is appreciated, and thanks very much to Tuvok for sharing his code.

Sent it to our entire team and we're all grateful.

:) Moondancer - EE Moderator
0
 
LVL 1

Author Comment

by:Moondancer
Comment Utility
Moondancer is leaving as a Moderator effective today and all Moondancer Email will be forwarded to others effective tomorrow.
It's been great, thanks for all the help and support.
:) Moondancer - EE Moderator
0
 

Expert Comment

by:BobJacobson
Comment Utility
I have had the same problem with one of my apps, it turned out to be a simple little problem with a message box routine.  

Dim Response

Response = msgbox("Are you sure you want to format your hard drive?", vbOKCancel, "WARNING")



It was crashing before the message box.  I added the full variable type and it fixed the problem.  It worked fine when running from within VB, but once compiled, it didn't like it.

Dim Response As VbMsgBoxResult

Hope this may help...
0
 

Expert Comment

by:BobJacobson
Comment Utility
I am also having problems with the runtime error 5 messages.  It works on some machines and not others even though they are the same OS's. I am trying to track it down myself.  I do know that I fixed one of the messages by actually DIMming a variable without a variant type.

Example:

  I had dimmed a variable for a message box response like this:

Dim Response

I added the extra "As VbMsgBoxResult", to read:

Dim Response As VbMsgBoxResult

This fixed the problem! This other way has worked for quite sometime.  I hope this helps. I am now dealing with the same issue on a UserID.SetFocus command on a form.  It worked all of the time, now that I added some other controls to the project, it seems to be acting up.

Can anyone shed anymore light on this situation?

               Bob
0
 
LVL 12

Expert Comment

by:roverm
Comment Utility
Hi Bob,

The runtime error 5 in the situation Moonie had, didn't have anything to do with programming errors orso.
It was just a change in the URL that ModTools tried to reach and that caused the error.

The error you are getting now could be that the SetFocus method is called to early, for instance in the FormLoad event.
Try calling it in the Form_Activate event.

D'Mzzl!
RoverM
0
 

Expert Comment

by:MSeitz
Comment Utility
I just had the same problem, and am a little embarrassed at what I found: The message box generates a form_paint event (I don't know if matters that the msgbox obscures part of the form or not). If there are any '.setfocus' instructions in the paint procedure, these will generate an error, since the focus is simultaneously being assigned to the msgbox and a control in the form, or the form itself.

I hope this helps you.

regards,
Markus
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now