Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: Programmatic ocx registration under Windows 7

08 Sep 2010   #1

Windows 7 32 professional
Programmatic ocx registration under Windows 7

I have a complex program as demo for my large application, which at the beginning is capable to programmatic register OCXs and launches another executable using programmatic command prompt. It works well under Windows XP but under Windows 7 runs properly only if I run it under administrator. If I donít run as administrator the only thing that I see is that the OCXs are not registered (one of the ocx is for showing images).
I would like to know if there is any way to programmatically register components as administrative rights (eventually additional parameter when I register components in command prompt).
With other words I would like the user of this demo to double click in the application and to be able to run everything as in Windows Xp, not launching application by right click choosing running it in certain way.

My System SpecsSystem Spec

09 Sep 2010   #2

Windows 7 32 bit

You could check into Inno Setup. You can have it register ocx files on install and unregister on uninstall just by using the "regserver" keyword. Also you can set the minimum install privilege to Administrator. The register and unregister of ocx should be done during install. Running a program that registers ocx without the user knowing it could be construed as malware these days. Better to just explain up front that the installer will register the ocx but the uninstall will automatically unregister and delete it.

You might also look into making a restore point before the install to reassure the customer they can get their system back to the state before it ever saw your demo.

edit: btw Inno Setup is free even for commercial use, and open source. I've used it for several years. In addition to the built in script mechanism, it does interpreted subset of Pascal so you can do things like check if certain registry settings exists or if files already exist on the system etc... there's easy detection if your program has already been installed using Inno Setup. Makes it easy to prompt the user during uninstall if they want to remove all registry settings or just remove files etc..

It's a mature and robust set up tool for Windows.
My System SpecsSystem Spec
09 Sep 2010   #3

Windows 7 32 professional

Thank you for answer,
I can not use any shell installer because customer should launch demo from CD and running everything from CD. It is true that my demo copyes components and database into local hard drive for registration and saving configuration then in the exit unregister and delete everything.
Similar as any installer silently register components I would like doing myself programmatically when administrator is logged on that computer.
I am waiting for suggestion.
My System SpecsSystem Spec

09 Sep 2010   #4

Windows 7 32 bit

See the COM functions DllRegisterServer and DllUnregisterServer
My System SpecsSystem Spec

 Programmatic ocx registration under Windows 7

Thread Tools

Similar help and support threads for2: Programmatic ocx registration under Windows 7
Thread Forum
Solved Windows registration information... General Discussion
Installing Windows 7 from registration key General Discussion
Windows Upgrade Offer Registration Now Available News
Windows registration info Windows Updates & Activation
Self-registration of DLL fails in Windows 7 Software
programmatic way with BAT file determining if elevated command prompt General Discussion
Registration question regarding Windows 7 General Discussion

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd

All times are GMT -5. The time now is 02:40 AM.
Twitter Facebook Google+

Windows 7 Forums

Seven Forums Android App Seven Forums IOS App

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33