1. 0 2.0

Creates an empty HPENDATA block.

Note This function is provided only for compatibility with version 1.0 of the Pen API and will not be supported in future versions. Use CreatePenDataEx instead.

HPENDATA CreatePenData( LPPENINFO lppeninfo, int cbOem, UINT uScale, UINT gmemFlags )



Address of tablet information to be inserted into the PENINFO structure in the pen data header. If this parameter is NULL, the current tablet settings are retrieved from the hardware instead. If there is no tablet, the pen data will not have an embedded PENINFO section and the wPndts member in PENDATAHEADER will have the PDTS_NOPENINFO flag set.


Width of OEM data packet. If this value is greater than or equal to 0, the OEM data overrides the contents of the PENINFO structure, if present; otherwise, a negative value such as pics/PENAPI00090000.gif1 can be used to specify that the system should calculate the size of the OEM data packet.


Data-scaling metric value. This parameter can be one of the following values:

Each logical unit is mapped to 0.1 millimeter. Positive x is to the right; positive y is down.
Each logical unit is mapped to 0.01 millimeter. Positive x is to the right; positive y is down.
Each logical unit is mapped to 0.001 inch. Positive x is to the right; positive y is down.
The application has done its own scaling of the data point.
The standard scaling metric; equivalent to PDTS_HIENGLISH.


Flag that specifies whether or not the Windows GlobalAlloc function should create a shared memory object when the pen data object is created. This should be either 0 or GMEM_DDESHARE. The GMEM_MOVEABLE and GMEM_ZEROINIT flags are added to this value, and other GMEM_ flags are ignored.

Return Value

Returns a handle to a new and empty pen data object if successful; otherwise, it returns NULL.


The application provides the PENINFO structure for the header, the real size of any OEM data stored with each coordinate, and the scale of the coordinates.

The uScale parameter specifies scaling values that are also used in the MetricScalePenData function and in the PENDATAHEADER structure member wPndts. The scaling values do not behave in the same way as the Windows scaling units with similar names. For example, a 1-inch line in MM_HIENGLISH will not necessarily be an inch long on the screen because GDI does not know the size of the monitor. However, with PDTS_HIENGLISH in MetricScalePenData, a line drawn an inch long is actually an inch long.

If lppeninfo is NULL, and if there is no tablet on the system (that is, if SendDriverMessage fails), it returns NULL.

The cbOem value must be less than or equal to 12, depending on the size of the OEM data packet. A value of 0 explicitly sets the amount of OEM information to none. A negative value indicates that the size of the OEM data packet is to be calculated by the system. Any existing value for the cbOemData member of PENINFO can be overwritten.

See Also

, DestroyPenData, PDTS_

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
Unix Manual Pages
Delphi Examples