Folks,
Having managed to get VB6 installed on Windows 7 without too many problems, I'm struggling to get OCX's to register.
I have created a simple user control (on my other PC - XP Pro) and it worked fine on this machine in runtime and design time.
I have now copied that project to the Windwo7 PC and the ocx will not register. When I rebuild the OCX I get the error msg: Error accessing registry.
This implies I cannot even create user controls / OCX's in VB6 on Windows 7.
Strange thing is when I create an MSI installer (on the XP machine) and install the program on a Vista or Window7 PC it works fine.
It appears the controls work in run time, but you can't use them in design time aaaahhh.....
Can anyone shed any light on this.

Thanks

Patrick

Dani AI

Generated

Short diagnosis and practical fix notes based on the thread (summary for the top of the topic).

The immediate cause is that VB6’s build/registration path writes type-library information into the classes store (HKCR\TypeLib). On modern Windows that is the merged classes view (HKLM\Software\Classes + HKCU\Software\Classes), so a non-elevated RegisterTypeLib call often fails with ACCESS DENIED while an elevated installer succeeds because it writes the per‑machine entries. See the Windows documentation for how type libraries are registered and the per‑user alternative (RegisterTypeLibForUser). (learn.microsoft.com)

Process Monitor traces are exactly the right way to confirm which key the IDE is trying to write; ’s ProcMon finding pointing to a TypeLib key matches the expected behavior. If the OCX registers when run from an elevated installer but fails in the IDE, that points to a registry-write permission / API choice rather than a binary problem. (learn.microsoft.com)

Practical next steps (in order):

  • Try registering the component from an elevated context on the target machine, being mindful of 32‑ vs 64‑bit toolsets (use the OS/bitness‑correct registration tool). If registration from an elevated prompt succeeds, repeat for any dependent TLBs. (learn.microsoft.com)
  • If design‑time registration must work without elevation, produce a development‑time installer or run the IDE with an elevated token so the TypeLib entries are written once for the machine. That’s why an MSI build made on XP and installed elevated worked for runtime in your reports. (learn.microsoft.com)
  • If those fail and you understand the risks, inspect and (only after a registry backup) repair permissions on HKCR\TypeLib (or take ownership) so the IDE can create the subkeys it needs; this is a last‑resort step and should be done carefully. (Microsoft guidance has used ownership changes for specific registry workarounds in the past.) (learn.microsoft.com)

Notes tied to this thread: ’s suggestion to check x86/x64 and administrator context is correct; ’s permission‑check advice is the right place to focus; ’s successful register attempt proves that elevated registration can fix the symptom. If more detail is wanted, include the exact OS bitness and whether the VB6 IDE was launched elevated so targeted steps can be suggested.

Recommended Answers

All 7 Replies

What OCX file are you having issues with?

Is this machine x64 or x86? Have you tried running as administrator? Have you tried creating a COM package for your OCX? Can you check permissions on this COM package?

Folks,
Having managed to get VB6 installed on Windows 7 without too many problems, I'm struggling to get OCX's to register.
I have created a simple user control (on my other PC - XP Pro) and it worked fine on this machine in runtime and design time.
I have now copied that project to the Windwo7 PC and the ocx will not register. When I rebuild the OCX I get the error msg: Error accessing registry.
This implies I cannot even create user controls / OCX's in VB6 on Windows 7.
Strange thing is when I create an MSI installer (on the XP machine) and install the program on a Vista or Window7 PC it works fine.
It appears the controls work in run time, but you can't use them in design time aaaahhh.....
Can anyone shed any light on this.

Thanks

Patrick

It's an X86 machine, I am running as administrator and I tried registering with and without UAC.
The issue is I can compile this OCX and register it in XP, but not in Windows 7.
If I add the user control to the project and compile it, no problem. I just cannot compile the user control as an OCX.

use regedit to see what permissions are set for the sub-key where you want to create a new key. You might not have permissions to do that.

I downloaded Process Monitor (used to be known as RegMon by SysInternals) and found the key wihhc had 'Access Dened' against it was HKCR\TypeLib\{long guid no}
I have compared the permissions in XP to those in Win7 on the HCCL\TypeLib key and the difference is that XP has CREATER OWNER set to 'Special Permissions'. I cannot set this in Win7, so I am suspecting that this is possibly the error, but I don't know what the fix is. Here's a link to a screen shot of Process Monitor http://www.mpssoftware.co.uk/progs/ProcMon.jpg

Patrick

Folks,
Having managed to get VB6 installed on Windows 7 without too many problems, I'm struggling to get OCX's to register.
I have created a simple user control (on my other PC - XP Pro) and it worked fine on this machine in runtime and design time.
I have now copied that project to the Windwo7 PC and the ocx will not register. When I rebuild the OCX I get the error msg: Error accessing registry.
This implies I cannot even create user controls / OCX's in VB6 on Windows 7.
Strange thing is when I create an MSI installer (on the XP machine) and install the program on a Vista or Window7 PC it works fine.
It appears the controls work in run time, but you can't use them in design time aaaahhh.....
Can anyone shed any light on this.

Thanks

Patrick

I am having the same problem and have tried all suggestions found on other sites. It was sad not to see a solution to our problem.

Re: Register mscomct2.ocx on windows 7 32 bit

i got this by run the cmd (run as administrator) then
c:\windows\system32> regsvr32 mscomct2.ocx

the file registered.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.