Programmatic ocx registration under Windows 7


  1. Posts : 2
    Windows 7 32 professional
       #1

    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 Computer


  2. Posts : 5,092
    Windows 7 32 bit
       #2

    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 Computer


  3. Posts : 2
    Windows 7 32 professional
    Thread Starter
       #3

    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.
    Virginia
      My Computer


  4. Posts : 5,092
    Windows 7 32 bit
       #4

    See the COM functions DllRegisterServer and DllUnregisterServer
      My Computer


 

  Related Discussions
Our Sites
Site Links
About 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 21:13.
Find Us