Avatar of RichardLudkiewicz
RichardLudkiewicz
 asked on

My VB6 will not allow me to use Microsoft Windows Common Controls-2 6.6 Saying that the Object Library not registered

I know that the mscomct2.ocx was registered correctly, But vb6 Disagrees so I cant use the dtpicker control.
DB Dev Tools

Avatar of undefined
Last Comment
Chris Raisin

8/22/2022 - Mon
Chris Raisin

There are several things you must do to register this component:

1. I assume you are running a Windows 7 PC (64Bit) PC since this error has occurred. You will need to copy the MSCOMCT2.OCX file to  "C:\Windows\sysWOW64" not "C:\Windows\system32".

2. Make sure you have mscomct2.ocx included in references within VB6 by clicking on Insert/Componements and browsing to the "SysWOW64" folder to add it to references.

Add OCX component to references
3. You must then register the component by running RegSvr32.exe from the command prompt:  
"regsvr32.exe c:\windows\sysWOW64\mscomct2.ocx"

Make sure that you run this command with administrator privileges. It is best to go into cmd.exe by
clicking on the "Start" button then typing "cmd.exe". You then right mouse-button click (RMBC) on the listed program "cmd.exe". From the context menu that appears choose "Run as administrator"). When the component registers correctly you will get the message:

OCX successfully regsitered
If you are not running a 64 bit machine then you can still register as per above, but place the compenment in the "C:|windows\System32" folder instead.

I hope this solves your problem.
RichardLudkiewicz

ASKER
I'm very sorry but it does not, I get all the correct responses on registering the component but when I go into VB6 and try to add the control to my project it comes up with The error message (Object Library not registered).
I have followed all off your instructions to the letter.  I should also add that this used to work ok on my old C drive but it went down and I had to replace with a new one, all programs and games are installed on a separate drive.
Chris Raisin

The control may be corrupted.

Try obtaining it again from a trusted source.
If you cannot find it I can upload via "EE Stuff".

The size should be:  647KB

It all worked for me and I attached a DTPicker to a form (showing a date). No problems.
But that, of course, is in a native VB6 application.

I know DTPicker has problems in Exceland other office applications when using VBA.

If you are doing this via VBA then an alternative object (much better) is obtainable from:
http://www.vbaexpress.com/kb/getarticle.php?kb_id=543 (Userform Calendar Control).

With VB6, do you have Service Pack 6 for a 32 bit machine? I cannot understand why it does notwork on your system.

Addendum: After a bit oif investigation, I suddenly realise that SysWOW64 is actually for 32 bit applications/components on a 64 bit machine, while c:\Windows\System32 is for 64 bit applications/components (does not seem to make sense, but there we go)! LOL :-)

I had a look at my c:\Windows\System32 folder and the component is NOT there, so it must be a 32 bit component (in the SysWow64 folder).

Make sure it is ONLY in your SysWOW62 folder.

You could try "unregistering" it using RegSvr32.exe and then re-register it.

Let me know how you go. When it installs, there are 5 components made available to the toolbox:
DTPicker, FlatScrollBar,UpDonw, MonthView and Animation.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
RichardLudkiewicz

ASKER
I have done all off the things you have recommended including downloading a new OCX and unregistering and then re-registering the OCX and still VB6 is Telling me that the (Object Library not registered)  even though its in the list. This is very important for me as I have at least 10 apps that I cant update anymore. The mscomct2.ocx I have is 633 KB there are no extra mscomct2.ocx on the C drive but there is an mscomct2.inf file in the same place.
Chris Raisin

I have four files in my SYSWOW64 Folder:

Files related to MSCOMCT2.OCX:
You could try renaming your "inf" file to "mscomct2.inf.old" then reboot your machine.
Another possibility is that VB6 is at fault (unlikely) so you could try uninstalling VB6 then re-installing, but before doing that, try getting the files I have available through the following link, installing then in your SYSWOW64 folder, then registering the OCX file as described earlier.

https://filedb.experts-exchange.com/incoming/ee-stuff/8397-MSCOMCT2_Files.zip

By the way, you should reboot after running REGSVR32.exe registration.

Let me know how you go.
RichardLudkiewicz

ASKER
I have done all that you have told me to do, the vb6 installation took out the oca so I copied it back and re-registered and all was fine rebooted the computer and started vb6 opened my app and tried to add the Microsoft Common Controls-2 6.0 And vb6 came back again with (Object library not registered).
Something you said at the beginning is bothering me,

Your Quote
2. Make sure you have mscomct2.ocx included in references within VB6 by clicking on Insert/Componements and browsing to the "SysWOW64" folder to add it to references.

I don't understand what you mean as the control appears in the list of components.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
RichardLudkiewicz

ASKER
Why Have I not had a solution yet it is very important that a solution is found for my problem.
Chris Raisin

Well if it shows in your list of components it has been added to your VB6 references,but that does not guarantee it has been registered.

Can you run the register process again (using regsvr32.exe under "administraion" provileges as detailed earlier) and get a screen capture of its acknowledgment that it has registered?

Once we confirm that it has indeed been registered, then we have reached a dead end.

If you like, I can make a video on how to install this praticulr component and maybe that may highlight something we have "miscommunicated" somehow thusfar.

Sorry about the delay.....I have just lost a family member and my thoughts took a while to get back to Experts Exchange.

Cheers
Chris
ASKER CERTIFIED SOLUTION
Chris Raisin

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
RichardLudkiewicz

ASKER
Thank You Thank You It has now worked I watched the video and just added the control from the installable tab and low and behold I have a date time picker thank you very much indeed.

Richard Ludkiewicz
Your help has saved me hundreds of hours of internet surfing.
fblack61
RichardLudkiewicz

ASKER
We got there in the end, thank you very much
Chris Raisin

My pleasure, Richard! Sorry the video was a bit hesitatnt, but it was prepared very quickly without any rehearsal.

I must admit I had not noticed that I was logged on as an administrator (as evidenced in the "cmd" command window) and so perhaps you DO need to be an administrator to register the OCX files via "RegSvr32.exe".

Usually PC's with only one user (like mine) have that one user with administrator "powers". It is only PC's that have multiple users which have one as an administrator and the others as "normal" users.

I am fairly certain that if you install the OCX, "unregister" it and then close your project and start it up again you will get an error when running the program. This is perhaps what happened to you.

Perhaps you created your project on a machine that has crashed and been rebuilt, or you uninstalled VB6 then re-instal;led it (which would clear all the registered OCX's in the registry) or you transferred your project to a new PC where the OCX was laready in use in your project but had not been freshly regsitered.  In any of these scenarios you would receive the error message which weas hainting you.

I guess also (because you stated that you had registered it using the "cmd" run of "regsvr32.exe") that either you were not an administrator at the time, or the OCX was placed in the wrong folder and registered there (in which case it is probably living in TWO folders so just remove it from the 64 bit folder by deleting the file).

Anyway, all's well that ends well, and as you can guess "a picture is worth a thousand words"....That is why I like to create videos whenever I can....It is also better to put them on YouTube because it helps more people (and saves EE disk space!)  :-)

Have a Merry Christmas and safe and exciting New Year........Regards from Australia.

Chris