4.   Using KEYpak SDK (Optional)

The KEYpak SDK (Software Development Kit) is included with your installation.  It allows developers to integrate KEYpak into other Windows applications using KEYpak components via the Conversion Manager API and Auto Detect API.

This chapter describes how to install and run the SDK demo programs, and then design and build your own application with KEYpak.

                        Note        This SDK is only for the 32-bit versions of the Windows operating system.

Installing the Demo Programs

The KEYpak SDK demo programs are installed as part of the main KEYpak program.  If you do a custom install from the KEYpak product disks, be sure to select the SDK Sample Code under the Miscellaneous option.  Once installed, you will see the Conversion Manager Sample Program and the Auto Detect Sample Program icons in the KEYpak NT group.  For detailed information on installing KEYpak, refer to Chapter 2 “Installing KEYpak” of this guide.  It is recommended that you also run KEYpak to verify that all functionality works on your system.

The demo programs will be installed to ...\KEYPAK\SDK\CMSAMPLE and ...\KEYPAK\SDK\KWADDEMO.  


Based on your installation, a listing of all the corresponding registry entries (INSTALL.INI) will be created in ...\KEYPAK\SDK\OEM.  You can update this file to suit your integration.  The [General] section contains HOME and SERVER entries.  Set these to the full path of where KEYpak will reside.



Running the Demo Programs

The demo program CMSAMPLE.EXE resides in the directory C:\KEYPAK\SDK\CMSAMPLE (where, C:\KEYPAK is the home directory for KEYpak).  You can invoke this program from the Program Manager File Run command or start File Manager and double-click on CMSAMPLE.EXE.  

The demo program KWADDEMO.EXE resides in the directory C:\KEYPAK\SDK\KWADDEMO (where, C:\KEYPAK is the home directory for KEYpak).  You can invoke this program from the Program Manager File Run command or start File Manager and double-click on KWADDEMO.EXE.  

Rebuilding the Demo Programs

To verify that your development environment is compatible with the KEYpak components, you should rebuild and run the demo programs before developing your own application.  You should not modify the demo programs source until you have successfully rebuilt and run the demo programs.

                        Note        When you build your application, you should use the same development environment as was used for the demo Programs, to ensure compatibility with all KEYpak components. That is, you should use Microsoft Visual C++ v4.1 or v4.2 to develop 32-bit applications.  If this is not feasible, then make sure to test your development environment by rebuilding and running the demo programs first.

To rebuild a demo program, you should use the Microsoft Visual C++ NMAKE program (NMAKE.EXE).

                                        nmake -fcmsample.mak or
nmake -fkwaddemo.mak
Start Microsoft Visual C++ and load the sample program (APPWizard) makefile.

                        Note        Make sure that structure packing is set to 8 bytes.

Rebuilding to use the INI File

By default, the conversion manager demo program uses KEYpak’s registry key Software\ANEResources\KEYpak, because this is the default KEYpak installation.

                        Note        If you use the registry, you must not use the default registry key name (Software\ANEResources\KEYpak),  because this registry key is used by the KEYpak program.  If your application uses the same registry key, it may not be able to run on the same system as KEYpak.

The demo program can be modified to use KEYpak initialization (INITIAL.INI) file instead of the registry key by defining CM_USE_INI in the CMSAMPLE.H file. 


1.     Modify the INITIAL.INI file located in C:\KEYPAK\SDK\OEM to use just the last sub-key for each section.  For example, modify the key [HKEY_LOCAL_MACHINE\SOFTWARE\Company Name\Product Name\KEYpak\General] to [General]. 

2.     Change the HOME and SERVER entries in the [General] section to indicate the directory where KEYpak was installed. 

3.     Rename the INITIAL.INI file to CMSAMPLE.INI and copy it to the windows system directory before running the demo program.

                        Note                The CMSAMPLE.INI located in C:\KEYPAK\SDK\CMSAMPLE is merely an example file.

Developing your Application

After rebuilding and running the demo program successfully, you are ready to begin developing your own application using the SDK.

Designing your Application

When designing your own application, you should use the demo program’s source (CMSAMPLE.C or KWADDEMO.C) as a guide or possibly even as a prototype for your own program. 

Before designing, you should refer to KPSDK.HLP located in C:\KEYPAK\SDK\HELP.  The help file contains the API and structure definitions, as well as a simple example of usage.