AccesSoft - Articles - Programme registration component
Main | Articles | Links | Map

Programme registration component

Usually registration (or her(its) cancelling) ActiveX-component is executed by means of autonomous utility regsvr32.exe. If necessary to execute the procedures to registrations at moment of the execution your VB-exhibits, that possible use address to this scrap by means of Shell. However exists one more way of the undertaking such operation, which defect is need iron enabling the name of the necessary component in code of the program.

This is because each ActiveX-component (ActiveX DLL or OCX) has a functions DllRegisterServer and DllUnregisterServer, executing operations to registrations/cancelling to registrations on own component. And address to him possible stright, as to usual DLL-functions.

For instance if you want software to conduct the operations to registrations of the component COMCTL32.OCX then in program it is necessary to describe two such functions:

' function to registrations of the component COMCTL32.OCX
Declare Function RegComCtl32 Lib "COMCTL32.OCX" Alias DllRegisterServer() As Long
' function of the cancelling to registrations of the component COMCTL32.OCX
Declare Function UnRegComCtl32 Lib "COMCTL32.OCX" Alias DllUnregisterServer() As Long

However follows to bear in mind that if you have not indicated the full way to file, that his(its) searching for will be realized in system or current directory only. Besides, when performing operation reasonable to realize the mechanism of the analysis possible error.

We shall Cite an instance code to registrations of the library Test.DLL, which is kept in free directory C:\MyApp:

Declare Function RegTestDLL Lib "Test.DLL" Alias DllRegisterServer() As Long 
Const ERROR_SUCCESS = 0&
Dim retCode As Long
On Error Resume Next 
' we include programme processing a mistake
ChDrive "C:"       
' We Install necessary
ChDir "C:\MyApp"    
' catalogue current
regCode = RegTestDLL() 
' the registration Test.DLL
' анализ возможных ошибок
If Err <> 0 Then
  MsgBox "Файл Test.DLL не найден"
Else 
  If regCode <> ERROR_SUCCES Then 
    MsgBox "Операция регистрации не выполнена"
  End If 
End If

The Used material: MSDN. The Advice 389.

Author: Joss It Is Added: 17.01.2008

Main | Articles | Links | Map
Бесплатный сайт nod32, антивирус. Nod32 бесплатно скачать русскую, антивирус.

Copyright 2007 - 2008 AccesSoft. All Rights Reserved