Using OCX Installer With VB6

Overview | Documentation | C# | VB.NET | VB6 | C/C++ | Download

You application calls OCX Installer in the first module's Sub Main, during application initialization:

Sub Main()
   If OCXInstaller_ProcessFile(True, _
TestApp_VBNET", "Softel vdm, Inc.", _ App.Path & "\SftTree_IX86_U_60.ocx", _
"%WinSys", True, False) = 0 Then Exit Sub ' VB6 applications need msvbvm60.dll If OCXInstaller_ProcessFile(True, _
"TestApp_VBNET", "Softel vdm, Inc.", _
App.Path & "\msvbvm60.dll", _
"%WinSys", True, False) = 0 Then Exit Sub
   Dim F As Form
   Set F = New Form1
   F.Show
End Sub

If you don't have a module yet, create a new module and make it the startup object (using the menu command Project, Properties...).

At the top of the source file containing your Sub Main, add the following declarations:

Declare Function OCXInstaller_ProcessFile Lib "OCXInstaller.dll" _
Alias "_OCXInstaller_ProcessFileA@28" ( _
ByVal Install As Integer, _
ByVal AppName As String, ByVal CompanyName As String, _
ByVal FileName As String, _
ByVal TargetPath As String, _
ByVal Register As Integer, ByVal ShareCount As Integer) As Integer
Declare Function OCXInstaller_GetMessages Lib "OCXInstaller.dll" _ Alias "_OCXInstaller_GetMessagesAsAnsiBSTR@0" () As String

In order to debug/execute your application, make sure to copy the OCXInstaller.Dll and all other required files (OCXes) to the folder containing your executable.

 

Sample

OCX Installer includes a complete VB6 sample including project files at

\Program Files\Softelvdm\OCX Installer\Samples\Sample_VB6

 

Product Info

 

Free Download

Register now and download this free product today to take advantage of easy ActiveX control installation!

Download Now