Link to home
Start Free TrialLog in
Avatar of Moondancer
Moondancer

asked on

Run-Time Error '5' invalid procedure or argument

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
Avatar of Moondancer
Moondancer

ASKER

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
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
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.
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.
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.
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
Could the runtime 5 error ever be a 'time out' kind of event?
ASKER CERTIFIED SOLUTION
Avatar of ameba
ameba
Flag of Croatia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>Could the runtime 5 error ever be a 'time out' kind of event?
It can be anything.
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?
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.
BTW, I do have riched32.dll in the windows\system directory, and it is version 5.1.2600 Wrapper Dll for Richedit 1.0
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...
My e-mail is in my profile, I can have a look if you send me something...
Thank you, sending now.
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.
Thanks, I'm receiving it... I'll check it and see if I can do something...
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.
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.
--------------------
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
Thanks again for the points and grade!

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

:)
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
Thanks, Tuvok.  It's a nice and useful program.  Good work!

Bruno
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
:"> 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

COOL, great.  Blushing is good.  ;)
Finally got Email from 6/17 onward, prior time, gone (so far).  Boo hoo.
Thanks,
Moondancer - EE Moderator
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)
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
OK. Thank you!
HUGS and thanks. :)
Hi, ameba.

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

Moondancer - EE Moderator
OK.  No problem.  :-)
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...
Great!
Thanks Bruno!!

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