Results 1 to 19 of 19

Thread: [RESOLVED] A run-time error 5

  1. #1

    Thread Starter
    Hyperactive Member Daniel Duta's Avatar
    Join Date
    Feb 2011
    Location
    Bucharest, Romania
    Posts
    397

    Resolved [RESOLVED] A run-time error 5

    Hello all,

    I created an application that requires to be installed by reason of besides the main executable file it has some files that have to be registered. After I packed all files and I tested the setup everything has worked well but once the same setup is run on my colleague PC each time an error code 5 occurs: "Invalid procedure, call or argument" ... I have no explanation for this. We all work in Windows7, the dependent files are there, the ocx files have been registered properly and I filled the application with error trappers. Nothing. The most interesting thing is I tried to customize the error trapping including the procedure name (ex. "Error in Form1 Load :" & Err.Number & " Details: " & Err.Description) hoping I could get a clue about that hidden error but in spite of this that error remained the same as before and without any string concatenated by me in those trappers.
    I am still looking for an explanation. Thank you.

  2. #2
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: A run-time error 5

    Does the pc that is not working have a newer version of IE installed than the one that works? Service Pack? Are you using the common controls in your project?

  3. #3

    Thread Starter
    Hyperactive Member Daniel Duta's Avatar
    Join Date
    Feb 2011
    Location
    Bucharest, Romania
    Posts
    397

    Re: A run-time error 5

    Quote Originally Posted by DataMiser View Post
    Does the pc that is not working have a newer version of IE installed than the one that works? Service Pack? Are you using the common controls in your project?
    Thank you DataMiser for your reply. I have just found out that we use different versions of IE: my version is 10 while the target PC has 9. But I cannot understand in what way could affect the IE a desktop app functionality. Yes, I use some common controls, comdlg32.ocx and mscomctl.ocx respectively. Besides, maybe I should mention that my PC - where I tested the setup - has the VB6 IDE installed.

  4. #4
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: A run-time error 5

    I would say that most likely your issue is the MSComctl

  5. #5

    Thread Starter
    Hyperactive Member Daniel Duta's Avatar
    Join Date
    Feb 2011
    Location
    Bucharest, Romania
    Posts
    397

    Re: A run-time error 5

    Maybe you have a serious reason to suspect that control...I will test tomorrow if something is wrong with it. Thank you.

  6. #6
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,176

    Re: A run-time error 5

    Also, you might try a 'simple' program....one without, first, any control using mscomctl, and then second, one without the commondialog ocx. That way, you can eliminate those two, or determine which of the two are the issue.

  7. #7

    Thread Starter
    Hyperactive Member Daniel Duta's Avatar
    Join Date
    Feb 2011
    Location
    Bucharest, Romania
    Posts
    397

    Re: A run-time error 5

    Yes, Sam, it was exactly what I had in mind for testing. However, I do not understand why no error trappping didn't work in my procedures. That error seems to be somehow outside of my application.

  8. #8
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,176

    Re: A run-time error 5

    Interesting...will be curious what the real issue is...once resolved, please let me know! :-)

  9. #9
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: A run-time error 5

    The error may be happening when it tries to load the control before it actually gets to your code

  10. #10
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,936

    Re: A run-time error 5

    Ohhh, I've got the answer to this one too. I got away from anything needing to be registered years ago. Microsoft has this side-by-side stuff that allows for using DLLs and OCXs without needing to register them. You just create an XML type file named the same as your .exe with the .manifest extension on it. For instance, let's say you have a program named CoolProgram.exe. You will have another file in the same folder named CoolProgram.exe.manifest.

    Ok, what's in this .manifest program? It's XML code that declares your DLLs and OCXs at runtime (with no need for the registry). The following is a .manifest file I use for one of my applications. It has much of the core VB6 OCX stuff in it. If you need the XML stuff for other OCXs or DLLs, you have to dig out the entry points. There are several programs for doing this but I'd recommend the program named "Make My Manifest" (or MMM.exe). You can find this on your own.

    A typical .manifest file is attached. Open the file in notepad and notice that I put my OCXs and DLLs in a subfolder below the .EXE called "Dependencies". I'll let you sort it from there.

    (And just before reading all of that .manifest stuff, if you're REALLY smart, you'll figure out how to use the .RES file (built into VB6) to wrap this .manifest file and all of your dependency files into the compiled .EXE, and then write code that extracts them from the .EXE the first time it runs.)

    Hmmm, well crud. VBForums doesn't like it as an attachment. Here's a link to it: http://motionlabresources.org/sample.exe.manifest

  11. #11

    Thread Starter
    Hyperactive Member Daniel Duta's Avatar
    Join Date
    Feb 2011
    Location
    Bucharest, Romania
    Posts
    397

    Re: A run-time error 5

    After I spent one day to replace 3 controls dependent on mscomctl.ocx (some progress bars, a tree view and a image list which was replaced with a image strip) the application worked like a charm. So the issue was exactly what DataMiser considered at the beginning. Interesting is the fact I haven't got this error in my PC but in other only, even the MS library keeps the same location in both : C:\Windows\SysWOW64. Simply it doesn't accept to be called by other applications developed outside. Could be this issue a start to find alternatives to the old MS controls mainly developed for Windows x86 (32-bit) ?

    Elroy, until now I didn't use manifest files for my apps but I noted this method is often used by many developers. I just wonder which is the benefit in this case. It is true, you avoid to write in the registry but you have to create a supplementary file instead. Maybe the unique advantage would be you do not need to have administrative privileges when you install a app that requires to register some libraries. I didn't find the MMM tool and I think your file was created with a similar tool that detected all those control entries.
    Thank you all.

  12. #12
    Frenzied Member
    Join Date
    May 2014
    Location
    Kallithea Attikis, Greece
    Posts
    1,289

    Re: A run-time error 5

    That's why I prefer to make my own controls...without wrapping any other control, only writing form scratch...

    http://www.vbforums.com/showthread.p...rius-Selectors

  13. #13
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,936

    Re: A run-time error 5

    Daniel,

    The biggest advantage is that you maintain control over which version of dependencies is being used by your application. Here's an example of how things can get messed up. Someone "installs" your application and starts using it. Subsequently, someone installs another application that makes use of some of the same dependencies, but they have what appears to be a later version. Therefore, Windows updates the dependency files. However, it turns out that their "updated" version is missing an entry point. Or, worse yet, has a virus embedded in it and makes it look like YOUR program is the cause of the virus. All of this has the well deserved name of DLL HELL. The .manifest idea was Microsoft's solution to this, and it's served me well.

    Regards,
    Elroy

  14. #14
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,936

    Re: A run-time error 5

    Ahhh, and a reply to GeorgeKar. Yes, I agree. I stopped using third party controls a LONG time ago. Even the Sheridan stuff was crap in the end. And yes, I've written many of my own controls and I just embed the actual source code for those controls in any VBP project I'm working on.

    However, I do make extensive use of the standard controls that came with VB6, and that includes the mscomctl.ocx, mscomct2.ocx, comct3332.ocx, richtx32.ocx, and tabctl32.ocx. I've found these to be very stable controls. I'd be sure that the VB6SP6 is installed though. As a further note, I DON'T use the common dialog control. I've long since written API calls that are much better than that common dialog OCX control.

    And just to brag, I've got my own controls for full Unicode support of labels, buttons, textboxes, and Unicode Notepad files. In addition, my Unicode textbox control can even have embedded pictures. It's cool to be able to throw my RTF button on a form and be able to underline or bold just one word on the button (or how about a button with green text).

    Take Care,
    Elroy

  15. #15
    Member
    Join Date
    Apr 2011
    Posts
    47

    Re: A run-time error 5

    @Elroy That's Great Elroy - care so share - otherwise yes it does just sound like Bragging

    cheers

  16. #16
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,936

    Re: [RESOLVED] A run-time error 5

    Hi Krammig,

    Here are a couple found in the codebank:

    RTF Label & RTF Button

    OptionButtonEx (grouping without frames, Unicode at runtime, & lightweight)

    Reading and Writing UTF-16 and UTF-8 Files

    And, there are a couple of others by me in the codebank as well. Anything specific you're looking for? You might do better to just ask.

    By the way, welcome to the forums.

    All The Best,
    Elroy
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  17. #17
    Member
    Join Date
    Apr 2011
    Posts
    47

    Re: [RESOLVED] A run-time error 5

    Hello Elroy,

    Thanks for the feedback, and nice of you to post those links, appreciated.

    Also thanks for the welcome

    cheers
    Mark

  18. #18
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,254

    Re: [RESOLVED] A run-time error 5

    Quote Originally Posted by Elroy View Post

    By the way, welcome to the forums.
    He's been here longer than you, Elroy!
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  19. #19
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,936

    Re: [RESOLVED] A run-time error 5

    Ahhhh, good point. I just noticed his number of posts, and then apparently glanced as the post date, rather than the join date. Well, Krammig, I guess I'll let you welcome me then.

    Y'all Take Care,
    Elroy
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width