Develop .NET Applications
This section describes how to create and deploy a .NET application by using the KeyView ActiveX Control. Although you can develop .NET applications in many different development environments, the instructions in this section refer to Microsoft Visual Studio 2005.
To create and deploy a .NET application
-
Install the KeyView Viewing SDK.
The installation automatically registers the Viewing ActiveX control, "KeyView OLE Control module (v1.0)" and installs the COM dynamic library (
kvocx.ocx
) to the Viewing\bin
directory. You can also use theregsvr32
command to register the ActiveX COM module. For example:regsvr32.exe install\bin\kvocx.ocx
-
In Visual Studio 2005, select Tools from the main menu, and click Choose Toolbox Items….
-
In the Choose Toolbox Items dialog box, click the COM Components tab.
-
From the list of available COM components, select the KeyView Control check box, and then click OK.
A Windows control named KeyView Control appears in the Toolbox. You can use this KeyView control in the same way as other controls in the Toolbox.
When the .NET application is built, Visual Studio creates the following dynamic libraries:
Interop.KEYVIEWLib.dll
AxInterop.KEYVIEWLib.dll
These libraries are wrappers for the KeyView ActiveX control, and are required to use the control in a .NET environment.
Method and Property Naming Conventions
The .NET control class name for KeyView ActiveX control is AxKEYVIEWLib.AxKEYview
, where the namespace AxKEYVIEWLib
is the library name.
In J#, C#, and C++, all ActiveX control method names in the .NET class are the same as their COM counterparts. However, individual properties in .NET are defined using get and set methods of the following format:
get_property_name
set_property name
For example, RegIniName
in COM has get_RegIniName
and set_RegIniName
methods in the .NET class.
IMPORTANT: In a Visual Basic .NET application, all properties and methods are used in the same way as in a Visual Basic COM application.
Sample Code
The following code demonstrates how to use the .NET class in a J# Windows Form program:
private void button1_Click(Object sender, System.EventArgs e) { this.axKEYview1.set_RegIniMode((short)1); this.axKEYview1.set_RegIniName("c:\windows\kvsdk.ini"); this.axKEYview1.Open("c:\test.doc"); }
The following code demonstrates how to use the .NET class in a Visual Basic Windows Form program:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click AxKEYview1.RegIniMode = 1 AxKEYview1.RegIniName = "c:\windows\kvsdk.ini" AxKEYview1.Open("c:\test.doc") End Sub
Deploy .NET Applications
After you have built a .NET application using Viewing ActiveX control, follow these steps to deploy the application:
-
Install all required files to the
\bin
directory of your application's installation directory. List of Files Required for Redistribution lists the components that must be redistributed with your application. It also shows the Dynamic Link Library (DLL) associated with each component. -
Review the
kvsdk.ini
file or theinstall.reg.txt
file to make sure that the appropriate files are referenced. -
Update the
HOME
entry in the initialization file or registry file with the complete path to where you are installing Viewing components. -
Specify whether you are using an initialization file or registry settings. See View Initialization Information.
-
If you are using an initialization file, install the file to the location specified by
RegIniName
when the application is installed. See RegIniName. -
If you are using the registry file, import the
install.reg
file into the Windows Registry when the application is installed. -
Install the Viewing ActiveX control (
kvocx.ocx
) to the\bin
directory of your application's installation directory. Register the control in the system registry by running the following command:regsvr32 C:\MyApp\bin\kvocx.ocx
Add
-s
to suppress any dialog boxes when registering the OCX. -
Install the wrapper files
Interop.KEYVIEWLib.dll
andAxInterop.KEYVIEWLib.dll
to the\bin
directory of your application's installation directory. -
Install the Microsoft .NET Framework Version 2.0 Redistributable Package, which is available at
http://msdn.microsoft.com/netframework/downloads/updates/default.aspx.
-
If the application is developed using J#, install the Microsoft Visual J# .NET Version 2.0 Redistributable Package, which is available at
http://msdn.microsoft.com/netframework/downloads/updates/default.aspx.