This article was brought to you by the guys from VDF-GUIdance.
For more DataFlex targeted articles see http://www.vdf-guidance.com


Regsvr32 replacement

by Allan Greis Eriksen

Summary

This Function makes it possible to register and deregister OCX and DLL files that have been designed for selfregistration. This is a replacement of the windows command file REGSVR32.EXE that you can use from within your application.
Size: 6 KB Download
Date Created: 14/07/2004
Date Updated: 14/07/2004
Author: Allan Greis Eriksen
Company: NordTeam Gruppen ApS


This package makes it possible to register and unregister activex components using VDF source code.
COM components are OCX, OLB, TLB and DLL files which have been designed for selfregistration.
In order to use such a component you will have to register them with windows. The standard way to do this is by calling an executable called REGSVR32.EXE already installed on the customer's PC. But this places a dependency between your application and the availability of the executable, although it will almost always be available.

This is a replacement of windows command file REGSVR32.EXE that you can use from inside your application.
I use it to activate OCX and DLL files that are used by my applications during startup of these applications.
All the OCX and DLL files that are required by the application have been placed in the \Programs directory and if the OCX or DLL has not been registered in windows for the machine that is running the application, it will be registered automatically. This eliminates the need for running an installer every time a new ocx or dll is used in new versions of my applications. This also assures that no other application (or user) has removed the ocx or dll registration.
In addition because registration is now an internal process of your application you can now better handle errors and unforeseen situations as an external setup program can.

How to use


Get RegServer "[your path]\Bszip.ocx" REGSERVER_REGISTER to bOk
(Register bszip.ocx in the path you specified. Ie. path to programs directory)

Get RegServer "[your path]\Bszip.ocx" REGSERVER_UNREGISTER to bOk
(Unregister bszip.ocx in the path you specified. Ie. path to programs directory)

Get RegServer "[your path]\Bszip.ocx" REGSERVER_REGISTER;
"{A726C70A-3AE3-4E65-8213-F74C8537B68F}" to bOk
(Register bszip.ocx as above but only if it has not already been registered. This can be useful during startup of your application.) Remember that the Class ID can be found in the package you genereated with FlexCOM for the OCX or DLL file.

Get RegServer "[your path]\Bszip.ocx" REGSERVER_UNREGISTER ;
"{A726C70A-3AE3-4E65-8213-F74C8537B68F}" to bOk
(Unregister bszip.ocx as above but only if it has not already been unregistered.

Download


regserver.zip ~ 3kb