Results 1 to 5 of 5

Thread: VB 372 error : Failed to load control y from x.ocx. Your version of y maybe outdated.

  1. #1

    Thread Starter
    Registered User
    Join Date
    Aug 2021
    Posts
    1

    Post VB 372 error : Failed to load control y from x.ocx. Your version of y maybe outdated.

    Hello All,

    I have a desktop application which is deployed on client machine, the client randomly gets this error once or twice a day. The ocx file and the control are my own custom controls. I have checked the version of the ocx and it all matches and are correct. I have also verified the version of the ocx in the registry and everything is correct there also.

    Do you guys have any other pointers which can help me in this issue?

    Exact Error :
    Failed to load control 'x' from y.ocx. Your version of y.ocx may be outdated. Make sure you are using the version of the control that was provided with your application."

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: VB 372 error : Failed to load control y from x.ocx. Your version of y maybe outda

    The file version number of the OCX doesn't mean much. It really only exists for the use of deployment tools, and for it to have real meaning discipline is required.

    What has probably failed is a mismatch of the interfaces implemented by your OCX. These are reflected by typelib's version, something entirely different. Type libraries are identified via a GUID, locale ID, and major/miner version numbers.

    Of course the typelib is only used for development and compilation. Type information is compiled into the program. In a sense they are predigested source code, analogous to a C header file.

    So your program was probably compiled against different interfaces from the ones actually implemented in the OCX that gets found at run time.

    That shouldn't be erratic (sometimes working, sometimes failing) but there are things that can cause this. For example an improper installer that results in a mishmash of versions, for example a local machine copy and virtualized copies that are different for each of one or more users.


    The best way to avoid that is to avoid having your program treated as "legacy" via a manifest that (at least) contains a proper trustInfo section. That and to use a proper installer for any updating of the OCX: 1. must run elevated, 2. must check for an existing older version, 3. if found uninstall the old and install the new.

    An alternative might be to use an isolation manifest to avoid the need to register the OCX. Of course that also means you must recompile your program if the OCX changes, generate a new manifest with the new OCX's type information, embed the new manifest in the EXE. You must also avoid placing the OCX in the same folder as the EXE (for example place it in a subdirectory pointed to by the manifest) or else the VB6 runtime may attempt to register it. Result: more chaos.


    Once you've let this happen it can be messy to clean up. You might have copies of different versions and their registry entries all over the place: local machine copy and different virtualized copies for each user on the machine.

  3. #3
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: VB 372 error : Failed to load control y from x.ocx. Your version of y maybe outda

    We have a production level application that has been plagued with problems like this for 15+ years plus. We learned to live with and these days our solutions are much like people used to do back in the day with those old TV sets, we just hit it until it works. The application is long overdue for a complete rewrite in a modern framework(We're considering Odoo right now). COM binaries like OCXes their DLL counterparts are just clumsy as hell to work with. You screw it up once, and you could be paying for it for years if you don't nip it in the bud.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

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

    Re: VB 372 error : Failed to load control y from x.ocx. Your version of y maybe outda

    Quote Originally Posted by Deeps008 View Post
    The ocx file and the control are my own custom controls.
    If this is actually true, and you have the source code to everything, one easy solution is to just pull the OCX's source code into your main project's source code, and then compile it as all one project ... thereby forgetting the external OCX files.
    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.

  5. #5
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: VB 372 error : Failed to load control y from x.ocx. Your version of y maybe outda

    Quote Originally Posted by Elroy View Post
    If this is actually true, and you have the source code to everything, one easy solution is to just pull the OCX's source code into your main project's source code, and then compile it as all one project ... thereby forgetting the external OCX files.
    Yea, this would be the most painless solution.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

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