Step 2: PE_SETTARGETS Submessage

Windows sends the WM_PENEVENT message with a PE_SETTARGETS submessage to the window that received the PE_BEGININPUT submessage. PE_SETTARGETS is important when several windows on the screen vie for input at the same time, presenting Windows with more than one potential recipient for the pen data. This can occur when a dialog box contains multiple edit controls or a forms program prompts the user simultaneously with several writing areas. The user can write in different writing areas without having to pause between each and wait for recognition results. Windows treats the writing as part of a single input session, regardless of the targets.

DoDefaultPenInput must therefore select between targets when distributing pen data. A target is a rectangular area associated with the handle of a window that is a valid destination for pen data. When writing starts, all valid targets participate in the DoDefaultPenInput messaging. This allows the user to move freely between windows pics/PENAPI00090001.gif for example, writing the name of a city in one control, interrupting to write the date in another control, then moving back to the first control to add the state and zip code. The system correctly routes pen input to the control on which ink was written or, barring that, to the control nearest the ink.

DoDefaultPenInput handles all routing automatically. Upon receiving a PE_SETTARGETS submessage, the application can process the message and create a TARGINFO structure that describes all valid targets for the pen data. If the application chooses not to process PE_SETTARGETS itself, DefWindowProc enumerates the children of the window and creates a TARGINFO structure automatically. If the application returns FALSE to the PE_SETTARGETS submessage, Windows assumes no targets exist and sends the pen data to the window that received PE_SETTARGETS.

For information on how to specify a target area larger than the window size, see the "PE_SETTARGETS Submessage"section.

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