Registering an ActiveX Component VB Help

Classes are registered automatically on the system on which they are designed. When you create DLL or EXE file that implements the Class, Visual Basic also registers it. But what if you Want to make the Class available to other developers working on different systems? If the component is an EXE server you can distribute the EXE file. Once it’s run on the target computer the Class will be registered automatically. No messages or Forms will be displayed. All you have to do is simply execute the server and it will register itself.

The situation is different for DLL components because they can’t be executed on their own. They .must be loaded in the address space of another application

(that’s why ActiveX DLLs are called in-process servers-they service only the process that hosts them). ActiveX DLLs must be registered with the REGRESS 32 utility, which comes with Visual Basic (it’s in the Tools/Reg Utils folder on the Visual Basic CD). REGRESS 32 is a program that allows you to register and un register in-process servers. Being able to un register out-of-process serves is just as important. For example removing the DLL files that implement the components isn’t enough. You must also un register the components themselves from the Registry which can be done with the REGRESS 32 utility.

To register an ActiveX DLL, create the DLL file with the Make ‘” ass Name dll command of the File menu (Class blame being hf name of your Class of course). Then copy this file to you windows System folder or any other folder. TO register the DLL open a Command Prompt window (a DOS window) switch to the . folder where the DLL resides and issue the following commnd:

C:\ WINOWS \SYSTEM\REGSVR32 Class Name.dll

Class Name.dll is the file that implements the server Tl-ere .”’P everal options you can use with the REGSVR32 utility. The / u option will uninstall a previously registered DLL. To uninstall the me Class blame.dll use the command:

REGSVR32 /u Class Name.dll

When new DLL is registered, the REGSVR utility reports the results of the operation in a message box. To suppress this message box, use the / s (silent) option. REGSVR32is the simplest mechanism for distributing DLL servers. All you have to do is write a small application that copies the DLL file to a folder and then run the REGSVR32 utility on the target computer to register it. If your decide to create distribution files for your component with the Package & Deployment Wizard, any component that must be installed with the application will be installed by the distribution application .

Posted on November 5, 2015 in Building AdiveX Components

Share the Story

Back to Top