1. 0

Initiates default handling of pen input.

int DoDefaultPenInput( HWND hwnd, UINT wEventRef )



Handle to the window initiating the default processing.


An identifier of a pen event in the input stream, from which input is begun. This identifier is the value returned from the GetMessageExtraInfo function.

Return Value

Returns one of the following values:

Pen collection was successfully started.
StartPenInput has already been called for this session.
The application aborted input.
Illegal parameter or unspecified error.
Invalid packet identifier.
Press-and-hold was detected. Collection is not started.
A pen tap was detected. Collection is not started.


simplifies the pen input process by including the following capabilities in a single call:

  • Starts pen input by calling StartPenInput

  • Starts inking by calling StartInking

  • Saves the screen background overwritten by the ink

  • Collects the pen input data

  • Stops inking by calling StopInking

  • Stops pen input by calling StopPenInput

  • Targets the pen input data to windows

  • Recognizes results

  • Sends the recognition results to the targets

The default processing proceeds in three phases: initialization, data gathering, and termination. A set of submessages corresponds to each of the three phases.

  • During the initialization phase, the system sends the WM_PENEVENT sub-message PE_SETTARGETS and potentially several PE_GETPCMINFO and PE_GETINKINGINFO messages. After the target or the DefWindowProc function handles these messages and returns a value of PCMR_OK to indicate success, the data-gathering phase begins.

  • During the data-gathering phase, the window specified by the hwnd parameter starts to receive the core pen-input submessages PE_PENDOWN, PE_PENUP, and PE_PENMOVE. The window should let these submessages fall through to DefWindowProc, which translates them into the higher-level messages PE_BEGINDATA and PE_MOREDATA. These are sent to one of the windows specified in the htrgTarget members of the TARGET structures if targeting is in progress; otherwise, the messages are sent to hwnd.

  • The termination phase begins when the pen input terminates. The target window should let the core termination messages PE_TERMINATING and PE_TERMINATED fall through to DefWindowProc. The PE_ENDDATA, PE_RESULT, and PE_ENDINPUT submessages are sent by DefWindowProc while processing PE_TERMINATED.

A return value of LRET_ABORT to any of the WM_PENEVENT submessages aborts the entire process of default input.

See Also

WM_PENEVENT, StartPenInput, StartInking, StopPenInput, StopInking

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