We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now


Exporting an Active X Control

Medium Priority
Last Modified: 2013-11-25
I developed an ActiveX Control using VC++ version 5, called MyactiveX.OCX (for example) . I used this control in a Visual Basic application. Everything was working OK until I decided to install my VB application on another computer. I used the Application Setup Wizard in VB to make distribution disks, everything went OK. Then, I tried to install this software on another comupter and the following message was given by the Install Shield:
 ( An error occur while registering the file 'C:\Windows\Sysytem\MyactiveX.OCX')
I appreciate any feedback on this problem.
Thankyou in advance
Watch Question


Edited text of question

probably you ocx needs a dll that is not installed on the other machine
you can try dumpbin (shipped with VC) to have a look which dll's your ocx needs
you have to run it in a Dos box
[path\]dumpbin /imports [sourcepath\]Myactivex.ocx >MyactiveXImports.txt
now you gets a list of all dlls that your ocx imports directly
take the list go to the other machine and look if some dll is missing


All DLL needed for the OCX are already installed. In my opinion, I need (somehow) to register in the windows registry (coming from the fact that the message comes up once the Install Field is updating the registry. I am afraid that did not answer the question.

did you check that all DLL's are installed or do you belive that only ?
for example you use VC++ 5 are you also using MFC ?
if so are you using MFC DLL version or static link ?
if you use DLL version are the right MFC DLL's installed ?
install shield trys to register your OCX and fails.
Registering an OCX is very simple:
an OCX is only a DLL
here some code that registers an ocx
text outputs are snipped
so only she basics are here
void CNregsDlg::RegisterLib(LPCTSTR LibName)
      HINSTANCE hInst;
      FARPROC proc;
                        //Error Library not found

      proc=GetProcAddress(hInst, "DllRegisterServer");
                      //error procedure not found

      proc();// now the ocx is registered

thats the only thing that happens when registering an ocx
therefore check DLL'S needed from OCX and DLL'S needed from DLL'S from OCX ...


Forgive my ignorancy, but where do I add the above codes.


I forgot to add that I am using VC++5, MFC in a shared DLL.
Also, the Install Shield message is as followed:
*** ERROR: LoadLibrary() Failed while registering file 'C:\Windows\System\MyActiveX.OCX'
*** DURING THIS ACTION: DllSelfRegister: "C:\Windows\System\MyActiveX.OCX"
*** ERROR: An error occured while registering the file 'C:\Windows\System\MyActiveX.OCX'.
and so on....

A registration program will attempt to do a LoadLibrary() of the ActiveX/DLL and call DLLRegister() on it. If LoadLibrary() fails and GetLastError() returns 1157, this means that a DLL needed by the control cannot be found. Use DUMPBIN as described above and keep in mind that the dependant dll's must already be installed when your ocx attempts registration. DLL's will only be found if they are in the current directory, in the windows system directory, or in a directory in your path. One of these dlls could also be trying to load another dll and cannot find it. The following files should be distributed with your ocx along with any other dll's you link to:


Hope this help.


I tried what you have suggested, it did not make any difference (I did include the three files in the App. Wizard).
One more comment I may add is: if I install VC++5, then I compile MyActiveX.OCX on the same machine, everything would work properly. Therefore, I think that I need to register this OCX somehow. I have no experience whatsoever with registering OCX.

if it installs and register perfectly after installing VC++ 5.0 there must be a missing DLL that is installed by VC that is the reason why it works with VC 5.0 installed not something magic register code.
A shot in the dark because you use VC 5.0:
VC 5.0 uses a newer version of MFC42.DLL.
Registering an OCX is nothing more than I described above.
Perhaps you should wrote your own register program using the skeleton above. Then you you can check better what errors occures


Dear whoever get this one first,
I followed your advise in Using Dumpbin.exe.
I know which DLL files are needed for MyActiveX, One of them is mfc42D.DLL.
I got rid of the message that displays error in registering MyActiveX. However, same error message appears for the file mfc42D.DLL.
I used Dumpbin.exe to find what DLL files are needed with mfc42D.DLL, they are:

I included all these files in my project Setup Wizard, but unlike MyActiveX.OCX doing this did not solve the problem.

Then, I used regsvr32.exe to manually register the program, it returns that GetLastError returns 0x000485 = 1157.

I am really puzzled here, help please.


an other thing each OCX needs are the OLE libraries - not sure which all OLE32.DLL OLEAUT.DLL OLEPRO.DLL ? this DLL's are also updated by VC5.0. Did you check the versions of these DLL'S ?

The reason you need mfc42d.dll and the others is because your doing a dubug build on your ocx. Try doing a release build and all you should need are the files I mentioned and any other dll's you might be using i.e if your using dao you'll need those dlls. You keep getting an 1157 message and that means your missing a dll. Keep searching.


You were right, I compiled a release version of the program and installation is working OK
Send your comment as an Answer in order for me to credit you.

Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.