Results 1 to 7 of 7

Thread: VB6 COM Object can't register in Vista

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2008
    Posts
    7

    VB6 COM Object can't register in Vista

    I created a COM object (DLL) with VB6 originally under Windows XP and everything worked fine. After upgrading my laptop to Vista the COM object appeared to still be working. I made a few very minor changes to the code and recompiled it. But now I cannot register the DLL anymore. I get the following error:

    "The module mydll was
    loaded but the call to DLLRegisterServer failed with
    error code 0x80004005."

    Any ideas why I might be getting this error all of a sudden?

    Thanks.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: VB6 COM Object can't register in Vista

    Welcome to the Forums.

    Its not all of a sudden as you made a change.

    Did you try unregistering and reregistering it?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2008
    Posts
    7

    Re: VB6 COM Object can't register in Vista

    Yeah I guess that was a bit of an overexaggeration :P but it's got me totally boggled why it was working before but now it won't register.

    I did unregister it first using the regsvr32.exe /u command and then reregistering. Funny thing is now when I try to unreg and rereg I get the same error message both ways.

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: VB6 COM Object can't register in Vista

    hmm, what is the compatibility of the ocx set to in its project when you compilied it? Project or Binary compatibility? I believe Project wil not change the guid for it.

    Also, when you registered it or installed your app with it, did you run the install/register as Administrator?

    It could be a broken link in the registry if the guid changed and/or not run as administrator
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    New Member
    Join Date
    Mar 2008
    Posts
    7

    Re: VB6 COM Object can't register in Vista

    Thanks for the replies!

    It's a DLL and it's set to compile to native code optimized for fast code. I did try to register it as an administrator too. I'm beginning to think that it is a problem with my registry too. If so, is there a safe way to fix it?

  6. #6
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: VB6 COM Object can't register in Vista

    It sounds as if it could be related to AppCompat registry virtualization.

    If you haven't yet, try to first unregister it with regsvr32 elevated (most easily via an elevated command prompt).

    You may have to do this again unelevated logged on as every user that has ever run the code which calls it. I'm not sure that even this will take care of it, because regsvr32 probably tests as "Vista aware" and it may never reach your virtualized component registration. You may have to hack away at this via regedit looking within the HKCU hive of each such user. Take a look at Registry Virtualization.


    One way to avoid this in the future is to stop running regsvr32. This statement may be too strong, but use regsvr32 with caution. If you must manually register via regsvr32, always do it elevated.

    Another thing you must do (if you insist on developing under Vista) is to make sure that you always run the VB6 IDE elevated. Preferably through the use of an application manifest with a <trustInfo> element in it, which tells Vista not to apply AppCompat shims such as registry virtualization.

    Thirdly, never copy a VB application with component libraries in the app folder to Vista and run it. You risk self-registration at the time the program first runs, almost certainly with virtualization. Use proper installer packages.

  7. #7

    Thread Starter
    New Member
    Join Date
    Mar 2008
    Posts
    7

    Re: VB6 COM Object can't register in Vista

    Okay thanks for that info. This COM object is legacy code originally designed for Win95 but has served well right up to XP which is the platform that it is still being used on. I'll try registering it on an XP system again and see if that works.

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