Appendix Using the 32-Bit Pen Application Programming Interface

This appendix describes the 32-bit pen services provided by the PENWIN32.DLL and PKPD32.DLL libraries. With some exceptions, these dynamic-link libraries (DLLs) offer Win32™-based applications the same pen-based support as the 16-bit libraries PENWIN.DLL and PKPD.DLL without requiring the intermediate steps of thunk conversions.

The services not supported by the 32-bit Pen Application Programming Interface (API) consist mainly of outdated functions no longer required in version 2.0. These outdated functions are supported in the 16-bit Pen API only to maintain backward compatibility with version 1.0. They will not be supported in future versions.

To enable 32-bit pen services, an application must be created in a 32-bit environ-ment pics/PENAPI00090001.gif that is, the compiler, linker, libraries, and header files must be of 32-bit type. Before including pertinent header files, the application must define the constant WIN32 as shown here:

#define WIN32

#include <windows.h>

#include <penwin.h>

A 32-bit application links to the pen system libraries in the same way it links to any other Windows library, with either of the following methods:

  • Link to the import library PKPD32.LIB (not recommended for PENWIN32.LIB) , or

  • Explicitly load PENWIN32.DLL and PKPD32.DLL with the LoadLibrary function. After loading the libraries, the application must call GetProcAddress to obtain the address of each Pen API function it intends to use. Before termin-ating, the application should call FreeLibrary to unload the libraries from memory.

The first method should normally be used to link functions in PKPD32.LIB. This method can be used for functions in PENWIN32.LIB if it is known for certain that the application will always be run on systems that have pen services installed, in which case the application should test for the existence of pen services at startup and exit if not found.

The second method should be used for PENWIN32.DLL functions when it is anticipated that the application may be run on systems where pen services are not installed. The reason for not linking PENWIN32.LIB is to prevent the application from loading PENWIN32.DLL on a system that has not loaded pen services at startup. This could happen, for example, on a computer that has PENWIN32.DLL on the path but has not installed pen services. Loading PENWIN32.DLL dynamic-ally does not sufficiently start pen services and errors are likely to occur.

In a 32-bit application, the call

GetSystemMetrics( SM_PENWINDOWS );

returns the handle of PENWIN32.DLL. This DLL makes available some of the same resources (such as cursors) provided by the 16-bit PENWIN.DLL library.

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database