Opening the Pen Driver

Before sending a driver a message, an application must first obtain a handle to the driver with the Windows OpenDriver function. The following code demonstrates this:

HDRVR hDrvPen;




hDrvPen = OpenDriver( "pen", NULL, NULL );

if( hDrvPen == NULL )


// The pen driver does not exist.

// Either display an error message and exit,

// or continue to function as a pen-unaware application.


As an example of how to send the driver messages, the following code uses the pen driver message DRV_SetPenSamplingRate to set the sampling rate to 200 points per second. A later segment of code then queries the driver to get relevant pen infor-mation.

WORD wOldRate;

wOldRate = SendDriverMessage( hDrvPen, // Driver handle

DRV_SetPenSamplingRate, // Message

200, // New rate in Hz

NULL ); // Not applicable




// Get information about the pen driver


BOOL PenHardwareExists;

fPenHardwareExists = SendDriverMessage( hDrvPen,




When finished, an application must close the handle to the installable driver with the CloseDriver function, as shown here:

CloseDriver( hDrvPen, NULL, NULL );

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