OCX Installer Documentation
|
Overview | Documentation | C# | VB.NET | VB6 | C/C++ | Download
Overview
OCX Installer Functions
Sample Application
Using OCX Installer In Your Application
C#
VB.NET
VB6
C/C++
Debugging OCX Installer
Download OCX Installer
Overview
OCX Installer installs ActiveX controls during application initialization, registers them in the Windows Registry and maintains a file share count for each installed application, making ClickOnce and XCOPY deployment possible for applications using Active controls on Windows 98, Windows ME, Windows 2000, Windows XP and Windows Server 2003. For Windows Vista, Registration-Free Activation must be used instead (due to User Account Control).
Additional information about OCX Installer is available here.
OCX Installer supports the following languages:
-
managed C#/VB.NET applications developed using Visual Studio .NET 2003, 2005, 2008. Visual Studio .NET 2002 is not supported.
-
unmanaged C/C++ applications (Visual C++ and others)
-
VB6 applications
-
any other language that can call an external DLL
|
OCX Installer Functions
|
ProcessFile |
Installs or uninstalls a file |
GetMessages |
Returns all messages generated during calls to ProcessFile by the current application. |
C#
Namespace Softelvdm.OCXInstaller
public static bool ProcessFile( bool Install, string AppName, string AppCompany, string InFile, string TargetPath, bool Register, bool ShareCount);
VB.NET
Namespace Softelvdm.OCXInstaller
Public Shared Function ProcessFile( _ Install As Boolean, _ AppName As String, AppCompany As String, _ InFile As String, TargetPath As System, _ Register As Boolean, ShareCount As Boolean) As Boolean
C/C++ (unmanaged)
extern BOOL WINAPI OCXInstaller_ProcessFile( BOOL Install, LPCTSTR AppName, LPCTSTR AppCompany, LPCTSTR InFile, LPCTSTR TargetPath, BOOL Register, BOOL ShareCount);
VB6
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
ProcessFile installs or uninstalls a file.
Install |
Set to True to install the file, False to uninstall |
AppName |
The name of your application, preferably a user-recognizable descriptive name as it appears in the splash screen when files are installed. The application name is also used as part of the registry key where information about installed files is stored. This information is stored at HKEY_LOCAL_MACHINE\SOFTWARE\Softel vdm, Inc.\OCXInstaller\your-AppCompany\your-AppName. This registry location is also useful for debugging purposes. If you are distributing the same files with multiple applications you must insure that each application uses a different application name. |
AppCompany |
The name of your company (or your name), preferably a user-recognizable descriptive name as it appears in the splash screen when files are installed. The company name is also used as part of the registry key where information about installed files is stored. This information is stored at HKEY_LOCAL_MACHINE\SOFTWARE\Softel vdm, Inc.\OCXInstaller\your-AppCompany\your-AppName. This registry location is also useful for debugging purposes. If you are distributing the same files with multiple applications you must insure that each application uses a different application name. |
InFile |
The file to be installed/uninstalled. This may be a relative or absolute path. The file must exist. While OCX Installer was designed for ActiveX controls, InFile can be any type of file, not just ActiveX controls (*ocx or *.dll).
It is strongly recommended that you use file versioning, so OCX Installer can determine when a file has been updated and it needs to be copied, even though it has been previously installed by the same application. |
TargetPath |
The directory where InFile is copied to. This may be an empty string, in which case InFile is not copied, but is assumed to already be in the correct location. If the target directory doesn't exist, it is created (multiple levels if necessary).
TargetPath can be specified as %WinSys, which is evaluated as the Windows System(32) directory. Most ActiveX controls need to be installed in the Windows System(32) directory. |
Register |
Set to True to (un)register the file, False otherwise. Whether the file is registered or unregistered depends on the Install argument. |
ShareCount |
Set to True to increment/decrement the file's share count, False otherwise. Whether the file's share count is incremented or decremented depends on the Install argument. The share count is only modified if the file is actually new and hasn't been previously installed by the same application. However (important), it is not recommended to set ShareCount to True, unless you actually uninstall the application. Otherwise, it is easier to disregard the ShareCount and set it to False. If another application removes the file, the OCX Installer will automatically reinstall the file.
|
Returns
ProcessFile returns True if the file has been installed/uninstalled without errors. If ProcessFile returns False, your application can assume that the installation failed and should not continue.
Comments
It is strongly recommended that you use file versioning, so OCX Installer can determine when a file has been updated and it needs to be copied, even though it has been previously installed by the same application.
The use of ShareCount is not recommended unless you also uninstall your application. With simple XCOPY or ClickOnce deployment, ShareCount should be set to False. This insures that regular installers can maintain an accurate ShareCount.
When an application calls ProcessFile to install a file, a small
splash screen is shown (for 10 seconds). It automatically closes after 10 seconds. This splash screen only appears when OCX Installer actually updates the installation, otherwise it is not shown. The splash screen cannot be suppressed.
C#
public static string GetMessages();
VB.NET
Public Shared Function GetMessages() As String
C/C++ (unmanaged)
extern LPCSTR WINAPI OCXInstaller_GetMessages();
VB6
Declare Function OCX_Installer_GetMessages Lib "OCXInstaller.dll" Alias "_OCXInstaller_GetMessagesAsAnsiBSTR@0" () As String
GetMessages returns all messages generated during calls to ProcessFile by the current application.
The string contains multiple lines of text, delimited by \r\n, suitable for display in a text box or to be displayed in a message box. If installation fails (ProcessFile returned False), your application may wish to enter some form of troubleshooting mode or display help information to the end-user. While ProcessFile already displays an error message outlining the cause of the failure, this may not always be sufficient for an end-user to determine how to resolve the issue.
The registry location HKEY_LOCAL_MACHINE\SOFTWARE\Softel vdm, Inc.\OCXInstaller\your-AppCompany\your-AppName contains all accumulated messages generated by the last invocation of OCX Installer by your application. your-AppCompany and your-AppName are placeholders for arguments provided to the ProcessFile function. |
Sample Application
|
We have prepared a simple sample application that uses two of our ActiveX controls (SftTree/OCX 6.0 and SftButton/OCX 2.5). When the application runs for the first time, the necessary controls (and dependencies, like gdiplus.dll) are installed.
NETSample |
Save, unzip and run Sample_CS.exe on any supported operating system (Win98 through Windows Server 2008) that has the .NET runtime v1.1 (or better) installed.
Please visit microsoft.com to download the .NET runtime if needed.
|
Sample |
Save, unzip and run Sample.exe on any supported operating system (Win98 through Windows Server 2008). Does not require the .NET runtime.
|
|
Using OCX Installer In Your Application
|
For detailed information about using OCX Installer in your
applications, please select one of the following supported languages:
C#
VB.NET
VB6
C/C++
If you are using another language, if it is capable of calling DLLs, the method used in C/C++ applications should be easily translatable to your language.
Download OCX Installer
|
Debugging OCX Installer
|
Whenever your application runs, OCX Installer will save any informational and error messages in the Windows registry. If something goes wrong, you can inspect the Windows Registry for detailed information (GetMessages also returns the same information, but is only available while your application is running).
To view the messages, use Regedit and locate HKEY_LOCAL_MACHINE\SOFTWARE\Softel vdm, Inc.\OCXInstaller\your-AppCompany\your-AppName\LastRun. your-AppCompany and your-AppName should be replaced with the company name and application name that are specified as the AppCompany and AppName arguments of the ProcessFile function. The value for the registry entry can be copied to a text editor (Visual Studio text file or Notepad). It contains detailed information about the install/uninstall progress and function return codes that may help troubleshoot installation problems.
|