OCX errors unless run as admin


  1. Posts : 14
    Windows 7 Ultimate
       #1

    OCX errors unless run as admin


    I have a program that when run as a normal user throws errors about ocx's being missing or not correctly registered. I dont want to grant users admin to run it. It runs with admin privileges fine.

    The thing is, once the program or a certain function has been run as admin that function will then run as a normal user. Why is this? Are files being registered as they are used?

    Is it possible to ensure all the files in the WHOLE program folder are registered somehow if the intaller is not doing it properly? REGSVR or similar?

    The program worked fine on Windows XP.
      My Computer


  2. Posts : 2,501
    Windows 7 Ultimate x64
       #2

    OCXs are library files that contain controls and functions used by applications (technically called "ActiveX controls"). To use those functionality, the OCX must be "registered", that is, certain registry entries are created so the program can look it up and use it. Problem is that those registry entries are located under the HKEY_CLASSES_ROOT, which by default is writable only by administrators. So at least, the registration process must be run as admin. From then, every user can read and use the OCX.

    It seems that the program is not registering the OCXs properly. Ideally, it should be done during install (which needs admin right anyway), but a buggy installer may fail to do this. In that case, the program may fall back to register on the very first use, which requires admin rights. After that first use, normal users can work normally. On XP with no UAC around, by default everyone is admin so it should work, but fail with a standard user.


    Regsvr32 does precisely that registration process manually. You call it once for each OCX and DLL file on the program folder to ensure each one is registered. Note that it may fail for certain files, since it's only applicable on ActiveX components, so ignore all errors you get. Of course, you need to do that in an elevated command line.
      My Computer


  3. Posts : 14
    Windows 7 Ultimate
    Thread Starter
       #3

    thanks for the reply, can some help with this batch file I want to run from an elevated command I can get it right:

    for %a in ('dir C:\Program Files (x86)\Star\my program\*.dll') do regsvr32 /s %a
    for %a in ('dir C:\Program Files (x86)\Star\my program\*.ocx') do regsvr32 /s %a

    for %a in ('dir C:\Program Files (x86)\Star\my program\directory1\*.dll') do regsvr32 /s %a
    for %a in ('dir C:\Program Files (x86)\Star\my program\directory1\*.ocx') do regsvr32 /s %a

    pause
      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 15:21.
Find Us