Pen Driver Messages

The following table describes the pen driver messages an application can use, the parameters that must be provided with each message, and the message return values.

Pen driver message
Meaning
Parameters
Return value
DRV_Configure
Requests the driver to display a configuration dialog box.
lParam1 LOWORD is the handle to a window that will own the dialog box;
lParam2 is 0.
Returns DRV_SUCCESS or, if the window handle is invalid, returns DRV_FAILURE.
DRV_GetCalibration
Instructs the driver to fill a CALBSTRUCT structure with the current calibration settings, including size and off-set values.
lParam1 is a far pointer to a CALBSTRUCT structure to be filled;
lParam2 is 0.
Returns DRV_SUCCESS or DRV_FAILURE if the installed tablet does not support re calibration. DRV_BADPARAM1 is returned if lParam1 is invalid.
DRV_GetName
Reports the name of the pen hardware.
lParam1 LOWORD is the length of the name buffer;
lParam2 is a LPSTR pointer to the name buffer.
If successful, returns the number of characters copied into the name buffer, which is the number of characters in the driver name plus 1 (the string null termina-tion character is copied into the buffer).
Otherwise, returns DRV_BADPARAM1 because provided buffer length is insufficient or DRV_BADPARAM2 because the provided memory block is not a writeable block of the specified size.
DRV_GetPenInfo
Fills in the PENINFO structure pointed to by the message's lParam1 parameter with the current pen parameters. If lParam1 is set to NULL, the driver checks for the presence of a pen tablet only.
lParam1 is a far pointer to a PENINFO structure to be filled;
lParam2 is 0.
Returns DRV_SUCCESS or DRV_FAILURE if no pen device is currently connected. DRV_BADPARAM1 is returned if the provided block of memory is not writeable or not large enough to contain a PENINFO structure.
DRV_GetPenSamplingRate
Returns the current sampling rate.
lParam1 is 0;
lParam2 is 0.
LOWORD contains the current sampling rate.
DRV_GetVersion
Reports the Pen API version number the driver supports and the pen packet size.
lParam1 is 0;
lParam2 is 0.
HIWORD contains the pen packet size in bytes. Within the LOWORD, HIBYTE contains the minor version number, LOBYTE is the major version number.
DRV_PenPlayBack
Sends an array of recorded pen packets to the driver, which the driver then sends back to the system as though receiving the packets in real time from the device.
lParam1 is a far pointer to an array of pen packets to be played through the system;
lParam2 LOWORD is the number of pen packets to play back, HIWORD is 0.
If successful, returns 1; if failure, returns a value less than 1.
DRV_PenPlayStart
Informs the pen driver of the format of the pen packet data it will receive after it receives the next DRV_PenPlayBack message. The driver does not begin sending pen packets into the system until it receives the DRV_PenPlayBack message.
lParam1 is a far pointer to a DWORD that is updated when the driver is done playing back pen packets;
lParam2 is either 0 or 1 and specifies the format of the pen packets passed to the driver (0 means version 1.0 packets and 1 means version 2.0 packets).
Returns DRV_SUCCESS or DRV_FAILURE if the pen system is already in playback mode.
DRV_PenPlayStop
Forces the driver out of playback mode.
lParam1 is 0;
lParam2 is 0.
Always returns DRV_SUCCESS (the pen driver was in play-back mode and the playback mode was successfully stopped or the pen driver was already out of playback mode).
DRV_Query
Returns whether or not the version 2.0 pen driver supports the specified message.
lParam1 LOWORD specifies the message queried about;
lParam2 is 0.
Returns DRV_SUCCESS if the message is supported or DRV_FAILURE if it is not.
DRV_QueryConfigure
Returns whether or not the driver can provide a configuration dialog box.
lParam1 is 0;
lParam2 is 0.
Returns DRV_SUCCESS if the driver provides a configuration dialog box or DRV_FAILURE if it does not.
DRV_SetCalibration
Sets the tablet calibration.
lParam1 is a far pointer to a CALBSTRUCT structure that describes the new calibration parameters the pen driver must use;
lParam2 is 0.
Returns DRV_SUCCESS or DRV_FAILURE if the tablet does not support calibration. DRV_BADPARAM1 is returned if lparam1 is not a pointer to a CALBSTRUCT structure.
DRV_SetPenSamplingDist
Sets the minimum pen sampling distance. Successive points less than the given distance do not generate new points. The distance is defined in raw tablet coordinates as the maximum of the change in x and y. The default distance is 0, which means that all pen events generate new events.
A pen driver does not have to simulate non zero sampling distances. An application must use the DRV_GetPenInfo driver message to determine the actual sampling distance set.
Pressing or releasing a pen barrel button gen-erates a new event, even if the pen does not move.
lParam1 HIWORD is 0;
lParam1 LOWORD is a new sampling distance;
lParam2 is 0.
If successful, HIWORD contains 0; LOWORD contains the previous sampling distance. Otherwise, returns DRV_FAILURE.
DRV_SetPenSamplingRate
Sets the pen sampling rate in samples per second.
lParam1 HIWORD is 0;
lParam1 LOWORD is a new sampling rate;
lParam2 is 0.
If successful, HIWORD contains 0; LOWORD contains the previous sampling rate.
Otherwise, returns DRV_FAILURE.

The calibration driver messages use the CALBSTRUCT structure defined as follows:

typedef struct

{

int wOffsetX;

int wOffsetY;

int wDistinctWidth;

int wDistinctHeight;

} CALBSTRUCT, FAR * LPCALPSTRUCT;

The wOffsetX and wOffsetY members are the amount in tablet coordinates that need to be added to the x- and y-coordinate values returned by the hardware for proper calibration. The wDistinctWidth and wDistinctHeight members have the same meaning as in the PENINFO structure.

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