Solved

Exporting an Active X Control

Posted on 1998-06-17
14
207 Views
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
0
Comment
Question by:khaledc
  • 7
  • 4
  • 3
14 Comments
 
LVL 1

Author Comment

by:khaledc
Comment Utility
Edited text of question
0
 
LVL 3

Expert Comment

by:Norbert
Comment Utility
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
example:
[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
i
0
 
LVL 1

Author Comment

by:khaledc
Comment Utility
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.
0
 
LVL 3

Expert Comment

by:Norbert
Comment Utility
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.
BTW
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;
      hInst=LoadLibrary(LibName);
      if(hInst==NULL)
      {
                        //Error Library not found
                       return;

      }
      proc=GetProcAddress(hInst, "DllRegisterServer");
      if(proc==NULL)
      {
                      //error procedure not found
                     return;
      }

      proc();// now the ocx is registered
      return;
}

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 ...

0
 
LVL 1

Author Comment

by:khaledc
Comment Utility
Forgive my ignorancy, but where do I add the above codes.
0
 
LVL 1

Author Comment

by:khaledc
Comment Utility
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....
0
 

Expert Comment

by:stevesu
Comment Utility
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:

mfc42.dll
msvcrt.dll
olepro32.dll

Hope this help.
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 1

Author Comment

by:khaledc
Comment Utility
stevesu,
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.
0
 
LVL 3

Expert Comment

by:Norbert
Comment Utility
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
0
 
LVL 1

Author Comment

by:khaledc
Comment Utility
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:
MSVCRTD.DLL
KERNEL32.DLL
GDI32.DLL
USER32.DLL

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.

 
0
 
LVL 3

Expert Comment

by:Norbert
Comment Utility
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 ?

0
 

Expert Comment

by:stevesu
Comment Utility
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.
0
 
LVL 1

Author Comment

by:khaledc
Comment Utility
stevesu,
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.

0
 

Accepted Solution

by:
stevesu earned 100 total points
Comment Utility
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.

Glad this helped, Khaledc.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
Before we dive into the marketing strategies involved with creating an effective homepage, it’s crucial that EE members know what a homepage is. In essence, a homepage is the introductory, or default page, of a website that typically highlights the …
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now