1 /****************************************************************************\
2 *                                                                                                                              *
3 * PENWIN.H -  Pen Windows functions, types, and definitions                              *
4 *                                                                                                                              *
5 *                     Version 2.0                                                                                      *
6 *                                                                                                                              *
7 *                     Copyright (c) 1992-1999 Microsoft Corp. All rights reserved.     *
8 *                                                                                                                              *
9 *******************************************************************************
10 *
11 * The following symbols control inclusion of various parts of this file;
12 * (indented identifiers are included by the previous main identifier):
13 *
14 * #define:               To prevent inclusion of:
15 *
16 * PENVER                  Pen Windows version number (0x0200).  To exclude
17 *                               definitions introduced in version 2.0 (or above)
18 *                               #define PENVER 0x0100 before #including <penwin.h>
19 *
20 * NOJAPAN                JAPAN-specific code
21 * NOPENALC               Alphabet Code definitions and macros
22 * NOPENAPPS             Pen Applications: Screen Keyboard
23 * NOPENCTL               H/BEDIT, IEDIT, and pen-enabled USER controls, including:
24 *     NOPENBEDIT          : Boxed Edit Control
25 *     NOPENIEDIT          : Ink Edit Control
26 *     NOPENHEDIT          : (H)Edit control
27 * NOPENDATA             PenData APIs and definitions
28 * NOPENDICT             Dictionary support
29 * NOPENDRIVER          Pen Driver definitions, incl OEM
30 * NOPENHRC               Handwriting Recognizer APIs and definitions
31 * NOPENINKPUT          Inking and Input APIs and definitions
32 * NOPENMISC             Miscellaneous Info and Utility APIs and definitions
33 * NOPENMSGS             Pen Messages and definitions
34 * NOPENNLS               National Language Support
35 * NOPENRC1               Recognition Context APIs and definitions (1.0)
36 * NOPENRES               Pen resources, including:
37 *     NOPENBMP             : Pen-related bitmaps
38 *     NOPENCURS           : Pen-related cursors
39 * NOPENTARGET          Targeting APIs and definitions
40 * NOPENVIRTEVENT     Virtual Event layer APIs
41 *
42 * _WIN32                  non-Win32 components, subincludes:
43 *                               : NOPENAPPS, NOPENDICT, NOPENRC1, NOPENVIRTEVENT
44 *
45 * "FBC" in the comments means that the feature exists only for
46 * backward compatibility. It should not be used by new applications.
47 \****************************************************************************/
48
49 #ifndef _INC_PENWIN
50 #define _INC_PENWIN
51
52 #if _MSC_VER > 1000
53 #pragma once
54 #endif
55
56 ///////////////////////////////////////////////////
57 #ifndef NOJAPAN     // unless expressly overridden...
58 #ifndef JAPAN
59 #define JAPAN        // This is the Japanese version!
60 #endif //!JAPAN
61 #endif //!NOJAPAN
62 ///////////////////////////////////////////////////
63
64 #include <windows.h>
65
66 #ifndef _WIN32
67 #ifndef RC_INVOKED
68 #pragma pack(1)
69 #endif /* RC_INVOKED */
70 #endif //!_WIN32
71
72 #ifdef __cplusplus
73 extern "C" {
74 #endif /* __cplusplus */
75
76 #ifndef PENVER          /* may be pre-defined; otherwise assume version 2.0 */
77       #define PENVER  0x0200
78 #endif //!PENVER
79
80 #ifdef _WIN32
81       #define NOPENAPPS
82       #define NOPENDICT
83       #define NOPENRC1
84       #define NOPENVIRTEVENT
85       #define NOPENAPIFUN
86 #endif //_WIN32
87
88 #ifndef NOPENAPPS     // not available in WIN32
89 #ifndef RC_INVOKED
90       #include <skbapi.h>
91 #endif /* !RC_INVOKED */
92 #endif /*!NOPENAPPS */
93
94 // other subsets:
95
96 #ifdef NOPENCTL
97       #define NOPENBEDIT
98       #define NOPENIEDIT
99 #endif /* NOPENCTL */
100
101 #ifdef NOPENRES
102       #define NOPENBMP
103       #define NOPENCURS
104 #endif /* NOPENRES */
105
106 //////////////////////////////////////////////////////////////////////////////
107 /****** Definitions 1: for everything including RC compiler *****************/
108
109 //---------------------------------------------------------------------------
110 #ifndef NOPENALC
111
112 // Enabled Alphabet:
113 #define ALC_DEFAULT                0x00000000L // nothing
114 #define ALC_LCALPHA                0x00000001L // a..z
115 #define ALC_UCALPHA                0x00000002L // A..Z
116 #define ALC_NUMERIC                0x00000004L // 0..9
117 #define ALC_PUNC                     0x00000008L // !-;`"?()&.,; and backslash
118 #define ALC_MATH                     0x00000010L // %^*()-+={}<>,/.
119 #define ALC_MONETARY               0x00000020L // ,.$ or local
120 #define ALC_OTHER                    0x00000040L // @#|_~[]
121 #define ALC_ASCII                    0x00000080L // restrict to 7-bit chars 20..7f
122 #define ALC_WHITE                    0x00000100L // white space
123 #define ALC_NONPRINT               0x00000200L // sp tab ret ctrl glyphs
124 #define ALC_DBCS                     0x00000400L // allow DBCS variety of SBCS
125 #define ALC_JIS1                     0x00000800L // kanji JPN, ShiftJIS 1 only
126 #define ALC_GESTURE                0x00004000L // gestures
127 #define ALC_USEBITMAP             0x00008000L // use rc.rgbfAlc to enable chars
128 #define ALC_HIRAGANA               0x00010000L // hiragana JPN
129 #define ALC_KATAKANA               0x00020000L // katakana JPN
130 #define ALC_KANJI                    0x00040000L // kanji JPN, ShiftJIS 1+2+3
131 #define ALC_GLOBALPRIORITY     0x10000000L
132 #define ALC_OEM                       0x0FF80000L // OEM recognizer-specific
133 #define ALC_RESERVED               0xE0003000L // avail for future use
134 #define ALC_NOPRIORITY           0x00000000L // for alcPriority == none
135
136 #define ALC_ALPHA\
137       (ALC_LCALPHA | ALC_UCALPHA)                                                     // 0x00000003L
138
139 #define ALC_ALPHANUMERIC\
140       (ALC_ALPHA | ALC_NUMERIC)                                                        // 0x00000007L
141
142 #define ALC_SYSMINIMUM\
143       (ALC_ALPHANUMERIC | ALC_PUNC | ALC_WHITE | ALC_GESTURE)      // 0x0000410FL
144
145 #define ALC_ALL\
146       (ALC_SYSMINIMUM | ALC_MATH | ALC_MONETARY\
147       | ALC_OTHER | ALC_NONPRINT)                                                     // 0x0000437FL
148
149 #define ALC_KANJISYSMINIMUM\
150       (ALC_SYSMINIMUM | ALC_HIRAGANA | ALC_KATAKANA | ALC_JIS1)  // 0x0003490FL
151
152 #define ALC_KANJIALL\
153       (ALC_ALL | ALC_HIRAGANA | ALC_KATAKANA | ALC_KANJI)             // 0x0007437FL
154
155 #endif /*!NOPENALC */
156
157 //---------------------------------------------------------------------------
158 #ifndef NOPENBEDIT
159 // box edit styles:
160 #define BXS_NONE                     0x0000U // none
161 #define BXS_RECT                     0x0001U // use rectangle instead of cusp
162 #define BXS_BOXCROSS               0x0004U // use cross at box center
163 #ifdef JAPAN
164 #define BXS_NOWRITING             0x0008U // no pen input into control
165 #else
166 #endif //JAPAN
167
168 #endif /*!NOPENBEDIT */
169
170 //---------------------------------------------------------------------------
171 #ifndef NOPENBMP
172
173 // Public Bitmaps :
174 #define OBM_SKBBTNUP                    32767
175 #define OBM_SKBBTNDOWN                32766
176 #define OBM_SKBBTNDISABLED          32765
177
178 #define OBM_ZENBTNUP                    32764
179 #define OBM_ZENBTNDOWN                32763
180 #define OBM_ZENBTNDISABLED          32762
181
182 #define OBM_HANBTNUP                    32761
183 #define OBM_HANBTNDOWN                32760
184 #define OBM_HANBTNDISABLED          32759
185
186 #define OBM_KKCBTNUP                    32758
187 #define OBM_KKCBTNDOWN                32757
188 #define OBM_KKCBTNDISABLED          32756
189
190 #define OBM_SIPBTNUP                    32755
191 #define OBM_SIPBTNDOWN                32754
192 #define OBM_SIPBTNDISABLED          32753
193
194 #define OBM_PTYBTNUP                    32752
195 #define OBM_PTYBTNDOWN                32751
196 #define OBM_PTYBTNDISABLED          32750
197
198 #endif /*!NOPENBMP */
199
200 //---------------------------------------------------------------------------
201 #ifndef NOPENCURS
202 // Default pen cursor to indicate writing, points northwest
203 #define IDC_PEN               MAKEINTRESOURCE(32631)
204
205 // alternate select cursor: upsidedown standard arrow, points southeast
206 #define IDC_ALTSELECT     MAKEINTRESOURCE(32501)
207
208 #endif /*!NOPENCURS */
209
210 //---------------------------------------------------------------------------
211 #ifndef NOPENHRC
212 // special SYV values:
213 #define SYV_NULL                          0x00000000L
214 #define SYV_UNKNOWN                     0x00000001L
215 #define SYV_EMPTY                         0x00000003L
216 #define SYV_BEGINOR                     0x00000010L
217 #define SYV_ENDOR                         0x00000011L
218 #define SYV_OR                              0x00000012L
219 #define SYV_SOFTNEWLINE               0x00000020L
220 #define SYV_SPACENULL                  0x00010000L     // SyvCharacterToSymbol('\0')
221
222 // SYV values for gestures:
223 #define SYV_SELECTFIRST               0x0002FFC0L     // . means circle in following
224 #define SYV_LASSO                         0x0002FFC1L     // lasso o-tap
225 #define SYV_SELECTLEFT                0x0002FFC2L     // no glyph
226 #define SYV_SELECTRIGHT               0x0002FFC3L     // no glyph
227 #define SYV_SELECTLAST                0x0002FFCFL     // 16 SYVs reserved for selection
228
229 #define SYV_CLEARCHAR                  0x0002FFD2L     // d.
230 #define SYV_HELP                          0x0002FFD3L     // no glyph
231 #define SYV_KKCONVERT                  0x0002FFD4L     // k.
232 #define SYV_CLEAR                         0x0002FFD5L     // d.
233 #define SYV_INSERT                       0x0002FFD6L     // ^.
234 #define SYV_CONTEXT                     0x0002FFD7L     // m.
235 #define SYV_EXTENDSELECT             0x0002FFD8L     // no glyph
236 #define SYV_UNDO                          0x0002FFD9L     // u.
237 #define SYV_COPY                          0x0002FFDAL     // c.
238 #define SYV_CUT                            0x0002FFDBL     // x.
239 #define SYV_PASTE                         0x0002FFDCL     // p.
240 #define SYV_CLEARWORD                  0x0002FFDDL     // no glyph
241 #define SYV_USER                          0x0002FFDEL     // reserved
242 #define SYV_CORRECT                     0x0002FFDFL     // check.
243
244 #define SYV_BACKSPACE                  0x00020008L     // no glyph
245 #define SYV_TAB                            0x00020009L     // t.
246 #define SYV_RETURN                       0x0002000DL     // n.
247 #define SYV_SPACE                         0x00020020L     // s.
248
249 // Application specific gestures, Circle a-z and Circle A-Z:
250 #define SYV_APPGESTUREMASK          0x00020000L
251 #define SYV_CIRCLEUPA                  0x000224B6L     // map into Unicode space
252 #define SYV_CIRCLEUPZ                  0x000224CFL     //  for circled letters
253 #define SYV_CIRCLELOA                  0x000224D0L
254 #define SYV_CIRCLELOZ                  0x000224E9L
255
256 // SYV definitions for shapes:
257 #define SYV_SHAPELINE                  0x00040001L
258 #define SYV_SHAPEELLIPSE             0x00040002L
259 #define SYV_SHAPERECT                  0x00040003L
260 #define SYV_SHAPEMIN                    SYV_SHAPELINE // alias
261 #define SYV_SHAPEMAX                    SYV_SHAPERECT // alias
262
263 // SYV classes:
264 #define SYVHI_SPECIAL                  0
265 #define SYVHI_ANSI                       1
266 #define SYVHI_GESTURE                  2
267 #define SYVHI_KANJI                     3
268 #define SYVHI_SHAPE                     4
269 #define SYVHI_UNICODE                  5
270 #define SYVHI_VKEY                       6
271 #endif //!NOPENHRC
272
273 //---------------------------------------------------------------------------
274 #ifndef NOPENIEDIT
275
276 // IEdit Pop-up Menu Command Items
277 #define IEM_UNDO                          1                // Undo
278 #define IEM_CUT                            2                // Cut
279 #define IEM_COPY                          3                // Copy
280 #define IEM_PASTE                         4                // Paste
281 #define IEM_CLEAR                         5                // Clear
282 #define IEM_SELECTALL                  6                // Select All Strokes
283 #define IEM_ERASE                         7                // Use Eraser
284 #define IEM_PROPERTIES                8                // DoProperties
285 #define IEM_LASSO                         9                // Use Lasso
286 #define IEM_RESIZE                       10               // Resize
287
288 #define IEM_USER                                 100      // first menu item# available to app
289
290 // IEdit Style Attributes
291 #define IES_BORDER                       0x0001     // ctl has a border
292 #define IES_HSCROLL                     0x0002     // ctl is horizontally scrollable
293 #define IES_VSCROLL                     0x0004     // ctl is vertically scrollable
294 #define IES_OWNERDRAW                  0x0008     // ctl will be drawn by parent window
295
296 #endif /*!NOPENIEDIT */
297
298 #ifndef RC_INVOKED  // ... rest of file of no interest to rc compiler
299 //////////////////////////////////////////////////////////////////////////////
300
301 /****** Definitions 2: RC compiler excluded ********************************/
302
303 //---------------------------------------------------------------------------
304 #ifndef NOPENDATA
305
306 // PenData API constants:
307
308 // ANIMATEINFO callback options:
309 #define AI_CBSTROKE                     0xFFFF  // Animate callback after every stroke
310
311 // ANIMATEINFO options:
312 #define AI_SKIPUPSTROKES             0x0001  // ignore upstrokes in animation
313
314 // CompressPenData() API options:
315 #define CMPD_COMPRESS                  0x0001
316 #define CMPD_DECOMPRESS               0x0002
317
318 // CreatePenDataRegion types:
319 #define CPDR_BOX                          1           // bounding box
320 #define CPDR_LASSO                       2           // lasso
321
322 // CreatePenData (CPD) and Pen Hardware (PHW) Flags;
323 // The order of PHW flags is important:
324 #define CPD_DEFAULT                     0x047F  // CPD_TIME | PHW_ALL
325 #define CPD_USERBYTE                    0x0100  // alloc 8 bits/stroke
326 #define CPD_USERWORD                    0x0200  // alloc 16 bits/stroke
327 #define CPD_USERDWORD                  0x0300  // alloc 32 bits/stroke
328 #define CPD_TIME                          0x0400  // maintain abs time info per stroke
329
330 // DrawPenDataEx() flags/options:
331 #define DPD_HDCPEN                       0x0001  // use pen selected in HDC
332 #define DPD_DRAWSEL                     0x0002  // draw the selection
333
334 // ExtractPenDataPoints options (EPDP_xx):
335 #define EPDP_REMOVE                     0x0001  // Remove points from the pendata
336
337 // ExtractPenDataStrokes options and modifiers (EPDS_xx):
338 #define EPDS_SELECT                     1           // selected strokes
339 #define EPDS_STROKEINDEX             2           // index
340 #define EPDS_USER                         3           // user-specific value
341 #define EPDS_PENTIP                     4           // complete pentip
342 #define EPDS_TIPCOLOR                  5           // pentip color
343 #define EPDS_TIPWIDTH                  6           // pentip width
344 #define EPDS_TIPNIB                     7           // pentip nib style
345 #define EPDS_INKSET                     8           // inkset match
346
347 #define EPDS_EQ                            0x0000  // default: same as
348 #define EPDS_LT                            0x0010  // all strokes less than
349 #define EPDS_GT                            0x0020  // all strokes greater than
350 #define EPDS_NOT                          0x0040  // all strokes not matching
351 #define EPDS_NE                            0x0040  // alias
352 #define EPDS_GTE                          0x0050  // alias for NOT LT
353 #define EPDS_LTE                          0x0060  // alias for NOT GT
354
355 #define EPDS_REMOVE                     0x8000  // remove matching strokes from source
356
357 // GetPenDataAttributes options (GPA_xx):
358 #define GPA_MAXLEN                       1     // length of longest stroke
359 #define GPA_POINTS                       2     // total number of points
360 #define GPA_PDTS                          3     // PDTS_xx bits
361 #define GPA_RATE                          4     // get sampling rate
362 #define GPA_RECTBOUND                  5     // bounding rect of all points
363 #define GPA_RECTBOUNDINK             6     // ditto, adj for fat ink
364 #define GPA_SIZE                          7     // size of pendata in bytes
365 #define GPA_STROKES                     8     // total number of strokes
366 #define GPA_TIME                          9     // absolute time at creation of pendata
367 #define GPA_USER                          10  // number of user bytes available: 0, 1, 2, 4
368 #define GPA_VERSION                     11  // version number of pendata
369
370 // GetStrokeAttributes options (GSA_xx):
371 #define GSA_PENTIP                       1     // get stroke pentip (color, width, nib)
372 #define GSA_PENTIPCLASS               2     // same as GSA_PENTIP
373 #define GSA_USER                          3     // get stroke user value
374 #define GSA_USERCLASS                  4     // get stroke's class user value
375 #define GSA_TIME                          5     // get time of stroke
376 #define GSA_SIZE                          6     // get size of stroke in points and bytes
377 #define GSA_SELECT                       7     // get selection status of stroke
378 #define GSA_DOWN                          8     // get up/down state of stroke
379 #define GSA_RECTBOUND                  9     // get the bounding rectangle of the stroke
380
381 // GetStrokeTableAttributes options (GSA_xx):
382 #define GSA_PENTIPTABLE               10  // get table-indexed pentip
383 #define GSA_SIZETABLE                  11  // get count of Stroke Class Table entries
384 #define GSA_USERTABLE                  12  // get table-indexed user value
385
386 #ifndef IX_END
387 #define IX_END                              0xFFFF  // to or past last available index
388 #endif //!IX_END
389
390 // PenTip:
391 #define PENTIP_NIBDEFAULT           ((BYTE)0)           // default pen tip nib style
392 #define PENTIP_HEIGHTDEFAULT      ((BYTE)0)           // default pen tip nib height
393 #define PENTIP_OPAQUE                  ((BYTE)0xFF)      // default opaque ink
394 #define PENTIP_HILITE                  ((BYTE)0x80)
395 #define PENTIP_TRANSPARENT          ((BYTE)0)
396
397 // General PenData API return values (PDR_xx):
398 #define PDR_NOHIT                         3           // hit test failed
399 #define PDR_HIT                            2           // hit test succeeded
400 #define PDR_OK                              1           // success
401 #define PDR_CANCEL                       0           // callback cancel or impasse
402
403 #define PDR_ERROR                         (-1)      // parameter or unspecified error
404 #define PDR_PNDTERR                     (-2)      // bad pendata
405 #define PDR_VERSIONERR                (-3)      // pendata version error
406 #define PDR_COMPRESSED                (-4)      // pendata is compressed
407 #define PDR_STRKINDEXERR             (-5)      // stroke index error
408 #define PDR_PNTINDEXERR               (-6)      // point index error
409 #define PDR_MEMERR                       (-7)      // memory error
410 #define PDR_INKSETERR                  (-8)      // bad inkset
411 #define PDR_ABORT                         (-9)      // pendata has become invalid, e.g.
412 #define PDR_NA                              (-10)     // option not available (pw kernel)
413
414 #define PDR_USERDATAERR               (-16)     // user data error
415 #define PDR_SCALINGERR                (-17)     // scale error
416 #define PDR_TIMESTAMPERR             (-18)     // timestamp error
417 #define PDR_OEMDATAERR                (-19)     // OEM data error
418 #define PDR_SCTERR                       (-20)     // SCT error (full)
419
420 // PenData Scaling (PDTS):
421 #define PDTS_LOMETRIC                  0           // 0.01mm
422 #define PDTS_HIMETRIC                  1           // 0.001mm
423 #define PDTS_HIENGLISH                2           // 0.001"
424 #define PDTS_STANDARDSCALE          2           // PDTS_HIENGLISH     alias
425 #define PDTS_DISPLAY                    3           // display pixel
426 #define PDTS_ARBITRARY                4           // app-specific scaling
427 #define PDTS_SCALEMASK                0x000F  // scaling values in low nibble
428
429 // CompactPenData() API trim options:
430 #define PDTT_DEFAULT                    0x0000
431 #define PDTT_PENINFO                    0x0100
432 #define PDTT_UPPOINTS                  0x0200
433 #define PDTT_OEMDATA                    0x0400
434 #define PDTT_COLLINEAR                0x0800
435 #define PDTT_COLINEAR                  0x0800  // alt sp alias
436 #define PDTT_DECOMPRESS               0x4000  // decompress the data
437 #define PDTT_COMPRESS                  0x8000
438 #define PDTT_ALL                          0x0F00  // PENINFO|UPPOINTS|OEMDATA|COLLINEAR
439
440 #define PHW_NONE                          0x0000  // no OEMdata
441 #define PHW_PRESSURE                    0x0001  // report pressure in OEMdata if avail
442 #define PHW_HEIGHT                       0x0002  // ditto height
443 #define PHW_ANGLEXY                     0x0004  // ditto xy angle
444 #define PHW_ANGLEZ                       0x0008  // ditto z angle
445 #define PHW_BARRELROTATION          0x0010  // ditto barrel rotation
446 #define PHW_OEMSPECIFIC               0x0020  // ditto OEM-specific value
447 #define PHW_PDK                            0x0040  // report per-point PDK_xx in OEM data
448 #define PHW_ALL                            0x007F  // report everything
449
450 // compact pen data trim options: matches PDTT_values (see above)
451 #define PDTS_COMPRESS2NDDERIV     0x0010  // compress using 2nd deriv
452 #define PDTS_COMPRESSMETHOD        0x00F0  // sum of compress method flags
453 #define PDTS_NOPENINFO                0x0100  // removes PENINFO struct from header
454 #define PDTS_NOUPPOINTS               0x0200  // remove up pts
455 #define PDTS_NOOEMDATA                0x0400  // remove OEM data
456 #define PDTS_NOCOLLINEAR             0x0800  // remove successive identical pts
457 #define PDTS_NOCOLINEAR               0x0800  // alt sp alias
458 #define PDTS_NOTICK                     0x1000  // remove timing info (2.0)
459 #define PDTS_NOUSER                     0x2000  // remove user info (2.0)
460 #define PDTS_NOEMPTYSTROKES        0x4000  // remove empty strokes (2.0)
461 #define PDTS_COMPRESSED               0x8000  // perform lossless compression
462
463 // SetStrokeAttributes options (SSA_xx):
464 #define SSA_PENTIP                       1           // set stroke tip (color, width, nib)
465 #define SSA_PENTIPCLASS               2           // set stroke's class pentip
466 #define SSA_USER                          3           // set stroke user value
467 #define SSA_USERCLASS                  4           // set stroke's class user value
468 #define SSA_TIME                          5           // set time of stroke
469 #define SSA_SELECT                       6           // set selection status of stroke
470 #define SSA_DOWN                          7           // set up/down state of stroke
471
472 // SetStrokeTableAttributes options (SSA_xx):
473 #define SSA_PENTIPTABLE               8           // set table-indexed pentip
474 #define SSA_USERTABLE                  9           // set table-indexed user value
475
476 // PenTip flag bits:
477 #define TIP_ERASECOLOR                1           // erase specific color pentip.rgb
478
479 // TrimPenData() API options:
480 #define TPD_RECALCSIZE                0x0000  // no trim, used for resize calc
481 #define TPD_USER                          0x0080  // per-stroke user info
482 #define TPD_TIME                          0x0100  // per-stroke timing info
483 #define TPD_UPPOINTS                    0x0200  // x-y data up points
484 #define TPD_COLLINEAR                  0x0400  // colinear and coincident points
485 #define TPD_COLINEAR                    0x0400  // alt sp alias
486 #define TPD_PENINFO                     0x0800  // PenInfo struct and all OEM
487 #define TPD_PHW                            0x1000  // OEM & pdk except stroke tick or user
488 #define TPD_OEMDATA                     0x1000  // ditto
489 #define TPD_EMPTYSTROKES             0x2000  // strokes with zero points
490 #define TPD_EVERYTHING                0x3FFF  // everything (incl PHW_xx) except down pts
491
492 #endif /*!NOPENDATA */
493
494 //---------------------------------------------------------------------------
495 #ifndef NOPENDICT     // not available in WIN32
496
497 // Dictionary:
498 #define cbDictPathMax                  255
499 #define DIRQ_QUERY                       1
500 #define DIRQ_DESCRIPTION             2
501 #define DIRQ_CONFIGURE                3
502 #define DIRQ_OPEN                         4
503 #define DIRQ_CLOSE                       5
504 #define DIRQ_SETWORDLISTS           6
505 #define DIRQ_STRING                     7
506 #define DIRQ_SUGGEST                    8
507 #define DIRQ_ADD                          9
508 #define DIRQ_DELETE                     10
509 #define DIRQ_FLUSH                       11
510 #define DIRQ_RCCHANGE                  12
511 #define DIRQ_SYMBOLGRAPH             13
512 #define DIRQ_INIT                         14
513 #define DIRQ_CLEANUP                    15
514 #define DIRQ_COPYRIGHT                16
515 #define DIRQ_USER                         4096
516 #endif /*!NOPENDICT */
517
518 //---------------------------------------------------------------------------
519 #ifndef NOPENDRIVER
520
521 // Pen driver:
522 #define BITPENUP                          0x8000
523
524 // Pen Driver messages:
525 #define DRV_SetPenDriverEntryPoints        DRV_RESERVED+1
526 #define DRV_SetEntryPoints                       DRV_RESERVED+1  // alias
527 #define DRV_RemovePenDriverEntryPoints  DRV_RESERVED+2
528 #define DRV_RemoveEntryPoints                  DRV_RESERVED+2  // alias
529 #define DRV_SetPenSamplingRate                DRV_RESERVED+3
530 #define DRV_SetPenSamplingDist                DRV_RESERVED+4
531 #define DRV_GetName                                   DRV_RESERVED+5
532 #define DRV_GetVersion                              DRV_RESERVED+6
533 #define DRV_GetPenInfo                              DRV_RESERVED+7
534 #define DRV_PenPlayStart                          DRV_RESERVED+8
535 #define DRV_PenPlayBack                            DRV_RESERVED+9
536 #define DRV_PenPlayStop                            DRV_RESERVED+10
537 #define DRV_GetCalibration                       DRV_RESERVED+11
538 #define DRV_SetCalibration                       DRV_RESERVED+12
539 #define DRV_Reserved1                               DRV_RESERVED+13
540 #define DRV_Reserved2                               DRV_RESERVED+14
541 #define DRV_Query                                      DRV_RESERVED+15
542 #define DRV_GetPenSamplingRate                DRV_RESERVED+16
543 #define DRV_Calibrate                               DRV_RESERVED+17
544
545 // Pen Driver Playback constants:
546 #define PLAY_VERSION_10_DATA 0
547 #define PLAY_VERSION_20_DATA 1
548
549 // Pen Driver return values:
550 #define DRV_FAILURE                     0x00000000
551 #define DRV_SUCCESS                     0x00000001
552 #define DRV_BADPARAM1                  0xFFFFFFFF
553 #define DRV_BADPARAM2                  0xFFFFFFFE
554 #define DRV_BADSTRUCT                  0xFFFFFFFD
555
556 // Pen Driver register messages flags:
557 #define PENREG_DEFAULT                0x00000002
558 #define PENREG_WILLHANDLEMOUSE  0x00000001
559
560 #define MAXOEMDATAWORDS               6                     // rgwOemData[MAXOEMDATAWORDS]
561
562 // Pen Collection Mode termination conditions:
563 // (note update doc for PCMINFO struct if change these)
564 #define PCM_PENUP                         0x00000001L     // stop on penup
565 #define PCM_RANGE                         0x00000002L     // stop on leaving range
566 #define PCM_INVERT                       0x00000020L     // stop on tap of opposite end
567 #define PCM_RECTEXCLUDE               0x00002000L     // click in exclude rect
568 #define PCM_RECTBOUND                  0x00004000L     // click outside bounds rect
569 #define PCM_TIMEOUT                     0x00008000L     // no activity for timeout ms
570 // new for 2.0:
571 #define PCM_RGNBOUND                    0x00010000L     // click outside bounding region
572 #define PCM_RGNEXCLUDE                0x00020000L     // click in exclude region
573 #define PCM_DOPOLLING                  0x00040000L     // polling mode
574 #define PCM_TAPNHOLD                    0x00080000L     // check for Tap And Hold
575 #define PCM_ADDDEFAULTS               RC_LDEFAULTFLAGS /* 0x80000000L */
576
577 // Pen Device Capabilities:
578 #define PDC_INTEGRATED                0x00000001L     // display==digitizer
579 #define PDC_PROXIMITY                  0x00000002L     // detect non-contacting pen
580 #define PDC_RANGE                         0x00000004L     // event on out-of-range
581 #define PDC_INVERT                       0x00000008L     // pen opposite end detect
582 #define PDC_RELATIVE                    0x00000010L     // pen driver coords
583 #define PDC_BARREL1                     0x00000020L     // barrel button 1 present
584 #define PDC_BARREL2                     0x00000040L     // ditto 2
Lines 585 ... 594 are skipped.
595 #define PDK_TRANSITION                0x0010  // set by GetPenHwData
596 #define PDK_UNUSED10                    0x0020
597 #define PDK_UNUSED20                    0x0040
598 #define PDK_INVERTED                    0x0080  // other end of pen used as tip
599 #define PDK_PENIDMASK                  0x0F00  // bits 8..11 physical pen id (0..15)
600 #define PDK_UNUSED1000                0x1000
601 #define PDK_INKSTOPPED                0x2000  // Inking stopped
602 #define PDK_OUTOFRANGE                0x4000  // pen left range (OEM data invalid)
603 #define PDK_DRIVER                       0x8000  // pen (not mouse) event
604
605 #define PDK_TIPMASK                     0x0001  // mask for testing PDK_DOWN
606
607 // OEM-specific values for Pen Driver:
608 #define PDT_NULL                          0
609 #define PDT_PRESSURE                    1           // pressure supported
610 #define PDT_HEIGHT                       2           // height above tablet
611 #define PDT_ANGLEXY                     3           // xy (horiz) angle supported
612 #define PDT_ANGLEZ                       4           // z (vert) angle supported
613 #define PDT_BARRELROTATION          5           // barrel is rotated
614 #define PDT_OEMSPECIFIC               16          // max
615
616 // Denotes the ID of the current packet
617 #define PID_CURRENT                     (UINT)(-1)
618
619 // Recognition and GetPenHwData Returns:
620 #define REC_OEM                            (-1024) // first recognizer-specific debug val
621 #define REC_LANGUAGE                    (-48)     // unsupported language field
622 #define REC_GUIDE                         (-47)     // invalid GUIDE struct
623 #define REC_PARAMERROR                (-46)     // bad param
624 #define REC_INVALIDREF                (-45)     // invalid data ref param
625 #define REC_RECTEXCLUDE               (-44)     // invalid rect
626 #define REC_RECTBOUND                  (-43)     // invalid rect
627 #define REC_PCM                            (-42)     // invalid lPcm parameter
628 #define REC_RESULTMODE                (-41)
629 #define REC_HWND                          (-40)     // invalid window to send results to
630 #define REC_ALC                            (-39)     // invalid enabled alphabet
631 #define REC_ERRORLEVEL                (-38)     // invalid errorlevel
632 #define REC_CLVERIFY                    (-37)     // invalid verification level
633 #define REC_DICT                          (-36)     // invalid dict params
634 #define REC_HREC                          (-35)     // invalid recognition handle
635 #define REC_BADEVENTREF               (-33)     // invalid wEventRef
636 #define REC_NOCOLLECTION             (-32)     // collection mode not set
637 #define REC_DEBUG                         (-32)     // beginning of debug values
638 #define REC_POINTEREVENT             (-31)     // tap or tap&hold event
639 #define REC_BADHPENDATA               (-9)      // invalid hpendata header or locking
640 #define REC_OOM                            (-8)      // out of memory error
641 #define REC_NOINPUT                     (-7)      // no data collected before termination
642 #define REC_NOTABLET                    (-6)      // tablet not physically present
643 #define REC_BUSY                          (-5)      // another task is using recognizer
644 #define REC_BUFFERTOOSMALL          (-4)      // ret by GetPenHwEventData()
645 #define REC_ABORT                         (-3)      // recog stopped by EndPenCollection()
646 #define REC_NA                              (-2)      // function not available
647 #define REC_OVERFLOW                    (-1)      // data overflow
648 #define REC_OK                              0           // interrim completion
649 #define REC_TERMBOUND                  1           // hit outside bounding rect
650 #define REC_TERMEX                       2           // hit inside exclusion rect
651 #define REC_TERMPENUP                  3           // pen up
652 #define REC_TERMRANGE                  4           // pen left proximity
653 #define REC_TERMTIMEOUT               5           // no writing for timeout ms
654 #define REC_DONE                          6           // normal completion
655 #define REC_TERMOEM                     512        // first recognizer-specific retval
656
657 #endif /*!NOPENDRIVER */
658
659 //---------------------------------------------------------------------------
660 #ifndef NOPENHRC
661
662 // Handwriting Recognizer:
663
664 // GetResultsHRC options:
665 #define GRH_ALL                            0           // get all results
666 #define GRH_GESTURE                     1           // get only gesture results
667 #define GRH_NONGESTURE                2           // get all but gesture results
668
669 // Gesture sets for EnableGestureSetHRC (bit flags):
670 #ifdef JAPAN
671 #define GST_SEL                            0x00000001L     // sel & lasso
672 #define GST_CLIP                          0x00000002L     // cut copy paste
673 #define GST_WHITE                         0x00000004L     // sp tab ret
674 #define GST_KKCONVERT                  0x00000008L     // kkconvert
675 #define GST_EDIT                          0x00000010L     // insert correct undo clear
676 #define GST_SYS                            0x0000001FL     // all of the above
677 #define GST_CIRCLELO                    0x00000100L     // lowercase circle
678 #define GST_CIRCLEUP                    0x00000200L     // uppercase circle
679 #define GST_CIRCLE                       0x00000300L     // all circle
680 #define GST_ALL                            0x0000031FL     // all of the above
681 #else
682 #define GST_SEL                            0x00000001L     // sel & lasso
683 #define GST_CLIP                          0x00000002L     // cut copy paste
684 #define GST_WHITE                         0x00000004L     // sp tab ret
685 #define GST_EDIT                          0x00000010L     // insert correct undo clear
686 #define GST_SYS                            0x00000017L     // all of the above
687 #define GST_CIRCLELO                    0x00000100L     // lowercase circle
688 #define GST_CIRCLEUP                    0x00000200L     // uppercase circle
689 #define GST_CIRCLE                       0x00000300L     // all circle
690 #define GST_ALL                            0x00000317L     // all of the above
691 #endif
692
693 // General HRC API return values (HRCR_xx):
694 #define HRCR_NORESULTS                4           // No possible results  to be found
695 #define HRCR_COMPLETE                  3           // finished recognition
696 #define HRCR_GESTURE                    2           // recognized gesture
697 #define HRCR_OK                            1           // success
698 #define HRCR_INCOMPLETE               0           // recognizer is processing input
699 #define HRCR_ERROR                       (-1)      // invalid param or unspecified error
700 #define HRCR_MEMERR                     (-2)      // memory error
701 #define HRCR_INVALIDGUIDE           (-3)      // invalid GUIDE struct
702 #define HRCR_INVALIDPNDT             (-4)      // invalid pendata
703 #define HRCR_UNSUPPORTED             (-5)      // recognizer does not support feature
704 #define HRCR_CONFLICT                  (-6)      // training conflict
705 #define HRCR_HOOKED                     (-8)      // hookasaurus ate the result
706
707 // system wordlist for AddWordsHWL:
708 #define HWL_SYSTEM                       ((HWL)1)     // magic value means system wordlist
709
710 // inkset returns:
711 #define ISR_ERROR                         (-1)      // Memory or other error
712 #define ISR_BADINKSET                  (-2)      // bad source inkset
713 #define ISR_BADINDEX                    (-3)      // bad inkset index
714
715 #ifndef IX_END
716 #define IX_END                              0xFFFF  // to or past last available index
717 #endif //!IX_END
718
719 #define MAXHOTSPOT                       8           // max number of hotspots possible
720
721 // ProcessHRC time constants:
722 #define PH_MAX                              0xFFFFFFFFL     // recognize rest of ink
723 #define PH_DEFAULT                       0xFFFFFFFEL     // reasonable time
724 #define PH_MIN                              0xFFFFFFFDL     // minimum time
725
726 // ResultsHookHRC options:
727 #define RHH_STD                            0           // GetResultsHRC
728 #define RHH_BOX                            1           // GetBoxResultsHRC
729
730 // SetWordlistCoercionHRC options:
731 #define SCH_NONE                          0           // turn off coercion
732 #define SCH_ADVISE                       1           // macro is hint only
733 #define SCH_FORCE                         2           // some result is forced from macro
734
735 // Symbol Context Insert Modes
736 #define SCIM_INSERT                     0           // insert
737 #define SCIM_OVERWRITE                1           // overwrite
738
739 // SetResultsHookHREC options:
740 #define SRH_HOOKALL                     (HREC)1 // hook all recognizers
741
742 // SetInternationalHRC options:
743 #define SSH_RD                              1           // to right and down (English)
744 #define SSH_RU                              2           // to right and up
745 #define SSH_LD                              3           // to left and down (Hebrew)
746 #define SSH_LU                              4           // to left and up
747 #define SSH_DL                              5           // down and to the left (Chinese)
748 #define SSH_DR                              6           // down and to the right (Chinese)
749 #define SSH_UL                              7           // up and to the left
750 #define SSH_UR                              8           // up and to the right
751
752 #define SIH_ALLANSICHAR               1           // use all ANSI
753
754 // TrainHREC options:
755 #define TH_QUERY                          0           // query the user if conflict
756 #define TH_FORCE                          1           // ditto no query
757 #define TH_SUGGEST                       2           // abandon training if conflict
758
759 // Return values for WCR_TRAIN Function
760 #define TRAIN_NONE                       0x0000
761 #define TRAIN_DEFAULT                  0x0001
762 #define TRAIN_CUSTOM                    0x0002
763 #define TRAIN_BOTH                       (TRAIN_DEFAULT | TRAIN_CUSTOM)
764
765 // Control values for TRAINSAVE
766 #define TRAIN_SAVE                       0           // save changes that have been made
767 #define TRAIN_REVERT                    1           // discard changes that have been made
768 #define TRAIN_RESET                     2           // use factory settings
769
770 // ConfigRecognizer and ConfigHREC options:
771 #define WCR_RECOGNAME                  0           // ConfigRecognizer 1.0
772 #define WCR_QUERY                         1
773 #define WCR_CONFIGDIALOG             2
774 #define WCR_DEFAULT                     3
775 #define WCR_RCCHANGE                    4
776 #define WCR_VERSION                     5
777 #define WCR_TRAIN                         6
778 #define WCR_TRAINSAVE                  7
779 #define WCR_TRAINMAX                    8
780 #define WCR_TRAINDIRTY                9
781 #define WCR_TRAINCUSTOM               10
782 #define WCR_QUERYLANGUAGE           11
783 #define WCR_USERCHANGE                12
784
785 // ConfigHREC options:
786 #define WCR_PWVERSION                  13          // ver of PenWin recognizer supports
787 #define WCR_GETALCPRIORITY          14          // get recognizer's ALC priority
788 #define WCR_SETALCPRIORITY          15          // set recognizer's ALC priority
789 #define WCR_GETANSISTATE             16          // get ALLANSICHAR state
790 #define WCR_SETANSISTATE             17          // set ALLANSICHAR if T
791 #define WCR_GETHAND                     18          // get writing hand
792 #define WCR_SETHAND                     19          // set writing hand
793 #define WCR_GETDIRECTION             20          // get writing direction
794 #define WCR_SETDIRECTION             21          // set writing direction
795 #define WCR_INITRECOGNIZER          22          // init recognizer and set user name
796 #define WCR_CLOSERECOGNIZER        23          // close recognizer
797
798 #define WCR_PRIVATE                     1024
799
800 // sub-functions of WCR_USERCHANGE
801 #define CRUC_NOTIFY                     0           // user name change
802 #define CRUC_REMOVE                     1           // user name deleted
803
804 // Word List Types:
805 #define WLT_STRING                       0           // one string
806 #define WLT_STRINGTABLE               1           // array of strings
807 #define WLT_EMPTY                         2           // empty wordlist
808 #define WLT_WORDLIST                    3           // handle to a wordlist
809
810 #endif /*!NOPENHRC */
811
812 //---------------------------------------------------------------------------
813 #ifndef NOPENIEDIT
814
815 // IEdit Background Options
816 #define IEB_DEFAULT                     0           // default (use COLOR_WINDOW)
817 #define IEB_BRUSH                         1           // paint background with brush
818 #define IEB_BIT_UL                       2           // bitmap, upper-left aligned
819 #define IEB_BIT_CENTER                3           // bitmap, centered in control
820 #define IEB_BIT_TILE                    4           // bitmap, tiled repeatedly in ctl
821 #define IEB_BIT_STRETCH               5           // bitmap, stretched to fit ctl
822 #define IEB_OWNERDRAW                  6           // parent window will draw background
823
824 // IEdit Drawing Options
825 #define IEDO_NONE                         0x0000  // no drawing
826 #define IEDO_FAST                         0x0001  // ink drawn as fast as possible (def)
827 #define IEDO_SAVEUPSTROKES          0x0002  // save upstrokes
828 #define IEDO_RESERVED                  0xFFFC  // reserved bits
829
830 // IEdit Input Options
831 #define IEI_MOVE                          0x0001  // move ink into ctl
832 #define IEI_RESIZE                       0x0002  // resize ink to fit within ctl
833 #define IEI_CROP                          0x0004  // discard ink outside of ctl
834 #define IEI_DISCARD                     0x0008  // discard all ink if any outside ctl
835 #define IEI_RESERVED                    0xFFF0  // reserved
836
837 // IEdit IE_GETINK options
838 #define IEGI_ALL                          0x0000  // get all ink from control
839 #define IEGI_SELECTION                0x0001  // get selected ink from control
840
841 // IEdit IE_SETMODE/IE_GETMODE (mode) options
842 #define IEMODE_READY                    0           // default inking, moving, sizing mode
843 #define IEMODE_ERASE                    1           // erasing Mode
844 #define IEMODE_LASSO                    2           // lasso selection mode
845
846 // IEdit      Notification Bits
847 #define IEN_NULL                          0x0000  // null notification
848 #define IEN_PDEVENT                     0x0001  // notify about pointing device events
849 #define IEN_PAINT                         0x0002  // send painting-related notifications
850 #define IEN_FOCUS                         0x0004  // send focus-related notifications
851 #define IEN_SCROLL                       0x0008  // send scrolling notifications
852 #define IEN_EDIT                          0x0010  // send editing/change notifications
853 #define IEN_PROPERTIES                0x0020  // send properties dialog notification
854 #define IEN_RESERVED                    0xFF80  // reserved
855
856 // IEdit Return Values
857 #define IER_OK                              0           // success
858 #define IER_NO                              0           // ctl cannot do request
859 #define IER_YES                            1           // ctl can do request
860 #define IER_ERROR                         (-1)      // unspecified error; operation failed
861 #define IER_PARAMERR                    (-2)      // bogus lParam value, bad handle, etc
862 #define IER_OWNERDRAW                  (-3)      // can't set drawopts in ownerdraw ctl
863 #define IER_SECURITY                    (-4)      // security protection disallows action
864 #define IER_SELECTION                  (-5)      // nothing selected in control
865 #define IER_SCALE                         (-6)      // merge:  incompatible scaling factors
866 #define IER_MEMERR                       (-7)      // memory error
867 #define IER_NOCOMMAND                  (-8)      // tried IE_GETCOMMAND w/no command
868 #define IER_NOGESTURE                  (-9)      // tried IE_GETGESTURE w/no gesture
869 #define IER_NOPDEVENT                  (-10)     // tried IE_GETPDEVENT but no event
870 #define IER_NOTINPAINT                (-11)     // tried IE_GETPAINTSTRUCT but no paint
871 #define IER_PENDATA                     (-12)     // can't do request with NULL hpd in ctl
872
873 // IEdit Recognition Options
874 #define IEREC_NONE                       0x0000  // No recognition
875 #define IEREC_GESTURE                  0x0001  // Gesture recognition
876 #define IEREC_ALL                         (IEREC_GESTURE)
877 #define IEREC_RESERVED                0xFFFE  // Reserved
878
879 // IEdit Security Options
880 #define IESEC_NOCOPY                    0x0001  // copying disallowed
881 #define IESEC_NOCUT                     0x0002  // cutting disallowed
882 #define IESEC_NOPASTE                  0x0004  // pasting disallowed
883 #define IESEC_NOUNDO                    0x0008  // undoing disallowed
884 #define IESEC_NOINK                     0x0010  // inking  disallowed
885 #define IESEC_NOERASE                  0x0020  // erasing disallowed
886 #define IESEC_NOGET                     0x0040  // IE_GETINK message verboten
887 #define IESEC_NOSET                     0x0080  // IE_SETINK message verboten
888 #define IESEC_RESERVED                0xFF00  // reserved
889
890 // IEdit IE_SETFORMAT/IE_GETFORMAT options
891 #define IESF_ALL                          0x0001  // set/get stk fmt of all ink
892 #define IESF_SELECTION                0x0002  // set/get stk fmt of selected ink
893 #define IESF_STROKE                     0x0004  // set/get stk fmt of specified stroke
894 //
895 #define IESF_TIPCOLOR                  0x0008  // set color
896 #define IESF_TIPWIDTH                  0x0010  // set width
897 #define IESF_PENTIP                     (IESF_TIPCOLOR|IESF_TIPWIDTH)
898 //
899
900 // IEdit IE_SETINK options
901 #define IESI_REPLACE                    0x0000  // replace ink in control
902 #define IESI_APPEND                     0x0001  // append ink to existing control ink
903
904 // Ink Edit Control (IEdit) definitions
905 // IEdit Notifications
906 #define IN_PDEVENT          ((IEN_PDEVENT<<8)|0)     // pointing device event occurred
907 #define IN_ERASEBKGND     ((IEN_NULL<<8)|1)          // control needs bkgnd erased
908 #define IN_PREPAINT        ((IEN_PAINT<<8)|2)        // before control paints its ink
909 #define IN_PAINT             ((IEN_NULL<<8)|3)          // control needs to be painted
910 #define IN_POSTPAINT      ((IEN_PAINT<<8)|4)        // after control has painted
911 #define IN_MODECHANGED  ((IEN_EDIT<<8)|5)          // mode changed
912 #define IN_CHANGE           ((IEN_EDIT<<8)|6)          // contents changed & painted
913 #define IN_UPDATE           ((IEN_EDIT<<8)|7)          // contents changed & !painted
914 #define IN_SETFOCUS        ((IEN_FOCUS<<8)|8)        // IEdit is getting focus
915 #define IN_KILLFOCUS      ((IEN_FOCUS<<8)|9)        // IEdit is losing focus
916 #define IN_MEMERR           ((IEN_NULL<<8)|10)        // memory error
917 #define IN_HSCROLL          ((IEN_SCROLL<<8)|11)     // horz scrolled, not painted
918 #define IN_VSCROLL          ((IEN_SCROLL<<8)|12)     // vert scrolled, not painted
919 #define IN_GESTURE          ((IEN_EDIT<<8)|13)        // user has gestured on control
920 #define IN_COMMAND          ((IEN_EDIT<<8)|14)        // command selected from menu
921 #define IN_CLOSE             ((IEN_NULL<<8)|15)        // I-Edit is being closed
922 #define IN_PROPERTIES     ((IEN_PROPERTIES<<8)|16) // properties dialog
923
924 #endif /*!NOPENIEDIT */
925
926 //---------------------------------------------------------------------------
927 #ifndef NOPENINKPUT
928
929 // PenIn[k]put API constants
930
931 // Default Processing
932 #define LRET_DONE                         1L
933 #define LRET_ABORT                       (-1L)
934 #define LRET_HRC                          (-2L)
935 #define LRET_HPENDATA                  (-3L)
936 #define LRET_PRIVATE                    (-4L)
937
938 // Inkput:
939 #define PCMR_OK                            0
940 #define PCMR_ALREADYCOLLECTING  (-1)
941 #define PCMR_INVALIDCOLLECTION  (-2)
942 #define PCMR_EVENTLOCK                (-3)
943 #define PCMR_INVALID_PACKETID     (-4)
944 #define PCMR_TERMTIMEOUT             (-5)
945 #define PCMR_TERMRANGE                (-6)
946 #define PCMR_TERMPENUP                (-7)
947 #define PCMR_TERMEX                     (-8)
948 #define PCMR_TERMBOUND                (-9)
949 #define PCMR_APPTERMINATED          (-10)
950 #define PCMR_TAP                          (-11)     // alias PCMR_TAPNHOLD_LAST
951 #define PCMR_SELECT                     (-12)     // ret because of tap & hold
952 #define PCMR_OVERFLOW                  (-13)
953 #define PCMR_ERROR                       (-14)     // parameter or unspecified error
954 #define PCMR_DISPLAYERR               (-15)     // inking only
955 #define PCMR_TERMINVERT               (-16)     // termination due to tapping opposite end of pen
956
957 #define PII_INKCLIPRECT               0x0001
958 #define PII_INKSTOPRECT               0x0002
959 #define PII_INKCLIPRGN                0x0004
960 #define PII_INKSTOPRGN                0x0008
961 #define PII_INKPENTIP                  0x0010
962 #define PII_SAVEBACKGROUND          0x0020
963 #define PII_CLIPSTOP                    0x0040
964
965 #define PIT_RGNBOUND                    0x0001
966 #define PIT_RGNEXCLUDE                0x0002
967 #define PIT_TIMEOUT                     0x0004
968 #define PIT_TAPNHOLD                    0x0008
969
970 #endif /*!NOPENINKPUT */
971
972 //---------------------------------------------------------------------------
973 #ifndef NOPENMISC
974
975 // Misc RC Definitions:
976 #define CL_NULL                            0
977 #define CL_MINIMUM                       1           // minimum confidence level
978 #define CL_MAXIMUM                       100        // max (require perfect recog)
979 #define cwRcReservedMax               8           // rc.rgwReserved[cwRcReservedMax]
980 #define ENUM_MINIMUM                    1
981 #define ENUM_MAXIMUM                    4096
982
983 #define HKP_SETHOOK                     0           // SetRecogHook()
984 #define HKP_UNHOOK                       0xFFFF
985
986 #define HWR_RESULTS                     0
987 #define HWR_APPWIDE                     1
988
989 #define iSycNull                          (-1)
990 #define LPDFNULL                          ((LPDF)NULL)
991 #define MAXDICTIONARIES               16          // rc.rglpdf[MAXDICTIONARIES]
992 #define wPntAll                            (UINT)0xFFFF
993 #define cbRcLanguageMax               44          // rc.lpLanguage[cbRcLanguageMax]
994 #define cbRcUserMax                     32          // rc.lpUser[cbRcUserMax]
995 #define cbRcrgbfAlcMax                32          // rc.rgbfAlc[cbRcrgbfAlcMax]
996 #define RC_WDEFAULT                     0xffff
997 #define RC_LDEFAULT                     0xffffffffL
998 #define RC_WDEFAULTFLAGS             0x8000
999 #define RC_LDEFAULTFLAGS             0x80000000L
1000
1001 // CorrectWriting() API constants:
1002 // LOWORD values:
1003 #define CWR_REPLACECR                  0x0001  // replace carriage ret (\r) with space
1004 #define CWR_STRIPCR                     CWR_REPLACECR  // alias for backward compatibility
1005 #define CWR_STRIPLF                     0x0002  // strip linefeed (\n)
1006 #define CWR_REPLACETAB                0x0004  // replace tab with space (\t)
1007 #define CWR_STRIPTAB                    CWR_REPLACETAB // alias for backward compatibility
1008 #define CWR_SINGLELINEEDIT          (CWR_REPLACECR|CWR_STRIPLF|CWR_REPLACETAB)  // all of the above
1009 #define CWR_INSERT                       0x0008  // use "Insert Text" instead of "Edit Text" in the title
1010 #define CWR_TITLE                         0x0010  // interpret dwParam as title string
1011 #define CWR_SIMPLE                       0x0040  // simple dialog (lens)
1012 #define CWR_HEDIT                         0x0080  // HEDIT CorrectWriting
1013 #define CWR_KEYBOARD                    0x0100  // keyboard lens
1014 #define CWR_BOXES                         0x0200  // bedit lens
1015
1016 // HIWORD values: keyboard types
1017 #define CWRK_DEFAULT                    0           // default keyboard type
1018 #define CWRK_BASIC                       1           // basic keyboard
1019 #define CWRK_FULL                         2           // full keyboard
1020 #define CWRK_NUMPAD                     3           // numeric keyboard
1021 #define CWRK_TELPAD                     4           // Telephone type keyboard
1022
1023 #ifdef JAPAN
1024 // CorrectWritingEx constants:
1025 #define CBCAPTIONCWX                    256 // size of caption buffer
1026 #define CKBCWX                              6     // number of keyboards
1027 #define XCWX                                 20  // default position and size
1028 #define YCWX                                 20
1029 #define CXCWX                               300
1030 #define CYCWX                               200
1031
1032 // CorrectWritingEx flags:
1033 #define CWX_TOPMOST                     0x00000001L
1034 #define CWX_NOTOOLTIPS                0x00000002L
1035 #define CWX_EPERIOD                     0x00000004L
1036 #define CWX_ECOMMA                       0x00000008L
1037 #define CWX_DEFAULT                     0x00000000L
1038
1039 // CorrectWritingEx apply flags - if these bits are set, corresp field used:
1040 #define CWXA_CONTEXT                    0x0001 // use cwx.dwFlags
1041 #define CWXA_KBD                          0x0002 // use cwx.ixkb
1042 #define CWXA_STATE                       0x0004 // use cwx.rgState[]
1043 #define CWXA_PTUL                         0x0008 // use cwx.ptUL
1044 #define CWXA_SIZE                         0x0010 // use cwx.sizeHW
1045 #define CWXA_NOUPDATEMRU             0x0020 // do not update Most Recently Used
1046
1047 // CorrectWritingEx keyboards:
1048 #define CWXK_HW                            0 // handwriting input
1049 #define CWXK_FIRST                       0x0100 // First keyboard, for ordinality
1050 #define CWXK_50                            0x0100 // 50-On kbd
1051 #define CWXK_QWERTY                     0x0101 // QWERTY kbd
1052 #define CWXK_NUM                          0x0102 // Tel/Num kbd
1053 #define CWXK_KANJI                       0x0103 // Kanji kbd
1054 #define CWXK_CODE                         0x0104 // Code finder kbd
1055 #define CWXK_YOMI                         0x0105 // Yomi ("reading") kbd
1056
1057 // CorrectWritingEx keyboard states:
1058 #define CWXKS_DEFAULT                  0xffff     // use existing kbd state
1059 #define CWXKS_ZEN                         0
1060 #define CWXKS_HAN                         1
1061 #define CWXKS_ROMAZEN                  2
1062 #define CWXKS_ROMAHAN                  3
1063 #define CWXKS_HIRAZEN                  4
1064 #define CWXKS_KATAZEN                  5
1065 #define CWXKS_KATAHAN                  6
1066
1067 // CorrectWritingEx returns:
1068 #define CWXR_ERROR                       -1 // error return
1069 #define CWXR_UNMODIFIED               0  // user pressed cancel button or no change
1070 #define CWXR_MODIFIED                  1  // user pressed changed text and OK button
1071 #endif //JAPAN
1072
1073 #ifdef JAPAN
1074 #define GPMI_OK                            0L
1075 #define GPMI_INVALIDPMI               0x8000L
1076 #endif // JAPAN
1077
1078 // inkwidth limits
1079 #define INKWIDTH_MINIMUM             0                  // 0 invisible, 1..15 pixel widths
1080 #define INKWIDTH_MAXIMUM             15                // max width in pixels
1081
1082 // Get/SetPenMiscInfo:
1083 // PMI_RCCHANGE is for WM_GLOBALRCCHANGE compatability only:
1084 #define PMI_RCCHANGE                    0           // invalid for Get/SetPenMiscInfo
1085
1086 #define PMI_BEDIT                         1           // boxed edit info
1087 #ifdef JAPAN
1088 #endif //JAPAN
1089 #define PMI_CXTABLET                    3           // tablet width
1090 #define PMI_CYTABLET                    4           // tablet height
1091 #define PMI_PENTIP                       6           // pen tip: color, width, nib
1092 #define PMI_ENABLEFLAGS               7           // PWE_xx enablements
1093 #define PMI_TIMEOUT                     8           // handwriting timeout
1094 #define PMI_TIMEOUTGEST               9           // gesture timeout
1095 #define PMI_TIMEOUTSEL                10          // select (press&hold) timeout
1096 #define PMI_SYSFLAGS                    11          // component load configuration
1097 #define PMI_INDEXFROMRGB             12          // color table index from RGB
1098 #define PMI_RGBFROMINDEX             13          // RGB from color table index
1099 #define PMI_SYSREC                       14          // handle to system recognizer
1100 #define PMI_TICKREF                     15          // reference absolute time
1101
1102 #define PMI_SAVE                          0x1000  // save setting to file
1103
1104 #ifdef JAPAN
1105 // GetPenResource options:
1106 #define GPR_CURSPEN                     1           // standard pen cursor
1107 #define GPR_CURSCOPY                    2           // copy cursor
1108 #define GPR_CURSUNKNOWN               3           // unknown cursor
1109 #define GPR_CURSERASE                  4           // erase cursor
1110
1111 #define GPR_BMCRMONO                    5           // monochrome Return bitmap
1112 #define GPR_BMLFMONO                    6           // monochrome LineFeed bitmap
1113 #define GPR_BMTABMONO                  7           // monochrome Tab bitmap
1114 #define GPR_BMDELETE                    8           // delete bitmap
1115 #define GPR_BMLENSBTN                  9           // lens buttonface bitmap
1116
1117 #ifdef JAPAN
1118 #define GPR_BMHSPMONO                  10          // hankaku space bitmap
1119 #define GPR_BMZSPMONO                  11          // zenkaku space bitmap
1120 #endif //JAPAN
1121
1122 #endif //JAPAN
1123
1124 // Set/GetPenMiscInfo/PMI_ENABLEFLAGS flags:
1125 #define PWE_AUTOWRITE                  0x0001  // pen functionality where IBeam
1126 #define PWE_ACTIONHANDLES           0x0002  // action handles in controls
1127 #define PWE_INPUTCURSOR               0x0004  // show cursor while writing
1128 #define PWE_LENS                          0x0008  // allow lens popup
1129
1130 // GetPenMiscInfo/PMI_SYSFLAGS flags:
1131 #define PWF_RC1                            0x0001  // Windows for Pen 1.0 RC support
1132 #define PWF_PEN                            0x0004  // pen drv loaded & hdwe init'd
1133 #define PWF_INKDISPLAY                0x0008  // ink-compatible display drv loaded
1134 #define PWF_RECOGNIZER                0x0010  // system recognizer installed
1135 #define PWF_BEDIT                         0x0100  // boxed edit support
1136 #define PWF_HEDIT                         0x0200  // free input edit support
1137 #define PWF_IEDIT                         0x0400  // ink edit support
1138 #define PWF_ENHANCED                    0x1000  // enh features (gest, 1ms timing)
1139 #define PWF_FULL\
1140     PWF_RC1|PWF_PEN|PWF_INKDISPLAY|PWF_RECOGNIZER|\
1141     PWF_BEDIT|PWF_HEDIT |PWF_IEDIT|PWF_ENHANCED
1142
1143 // SetPenAppFlags() / RegisterPenApp() API constants:
1144 #define RPA_DEFAULT                     0x0001  // == RPA_HEDIT
1145 #define RPA_HEDIT                         0x0001  // convert EDIT to HEDIT
1146 #define RPA_KANJIFIXEDBEDIT        0x0002
1147 #define RPA_DBCSPRIORITY             0x0004  // assume DBCS has priority (Japan)
1148 #define RPA_SBCSPRIORITY             0x0008  // assume SBCS has priority (Japan)
1149
1150 #define PMIR_OK                            0L
1151 #define PMIR_INDEX                       (-1L)
1152 #define PMIR_VALUE                       (-2L)
1153 #define PMIR_INVALIDBOXEDITINFO (-3L)
1154 #define PMIR_INIERROR                  (-4L)
1155 #define PMIR_ERROR                       (-5L)
1156 #define PMIR_NA                            (-6L)
1157
1158 #ifdef JAPAN
1159 #define SPMI_OK                            0L
1160 #define SPMI_INVALIDBOXEDITINFO 1L
1161 #define SPMI_INIERROR                  2L
1162 #define SPMI_INVALIDPMI               0x8000L
1163 #endif //JAPAN
1164
1165 #endif /*!NOPENMISC */
1166
1167 //---------------------------------------------------------------------------
1168 #ifndef NOPENRC1      // not available in WIN32
1169
1170 // RC Options and Flags:
1171 // GetGlobalRC() API return codes:
1172 #define GGRC_OK                            0           // no err
1173 #define GGRC_DICTBUFTOOSMALL      1           // lpDefDict buffer too small for path
1174 #define GGRC_PARAMERROR               2           // invalid params: call ignored
1175 #define GGRC_NA                            3           // function not available
1176
1177 // RC Direction:
1178 #define RCD_DEFAULT                     0           // def none
1179 #define RCD_LR                              1           // left to right like English
1180 #define RCD_RL                              2           // right to left like Arabic
1181 #define RCD_TB                              3           // top to bottom like Japanese
1182 #define RCD_BT                              4           // bottom to top like some Chinese
1183
1184 // RC International Preferences:
1185 #define RCIP_ALLANSICHAR             0x0001  // all ANSI chars
1186 #define RCIP_MASK                         0x0001
1187
1188 // RC Options:
1189 #define RCO_NOPOINTEREVENT          0x00000001L     // no recog tap, tap/hold
1190 #define RCO_SAVEALLDATA               0x00000002L     // save pen data like upstrokes
1191 #define RCO_SAVEHPENDATA             0x00000004L     // save pen data for app
1192 #define RCO_NOFLASHUNKNOWN          0x00000008L     // no ? cursor on unknown
1193 #define RCO_TABLETCOORD               0x00000010L     // tablet coords used in RC
1194 #define RCO_NOSPACEBREAK             0x00000020L     // no space break recog -> dict
1195 #define RCO_NOHIDECURSOR             0x00000040L     // display cursor during inking
1196 #define RCO_NOHOOK                       0x00000080L     // disallow ink hook (passwords)
1197 #define RCO_BOXED                         0x00000100L     // valid rc.guide provided
1198 #define RCO_SUGGEST                     0x00000200L     // for dict suggest
1199 #define RCO_DISABLEGESMAP           0x00000400L     // disable gesture mapping
1200 #define RCO_NOFLASHCURSOR           0x00000800L     // no cursor feedback
1201 #define RCO_BOXCROSS                    0x00001000L     // show + at boxedit center
1202 #define RCO_COLDRECOG                  0x00008000L     // result is from cold recog
1203 #define RCO_SAVEBACKGROUND          0x00010000L     // Save background from ink
1204 #define RCO_DODEFAULT                  0x00020000L     // do default gesture processing
1205
1206 // RC Orientation of Tablet:
1207 #define RCOR_NORMAL                     1           // tablet not rotated
1208 #define RCOR_RIGHT                       2           // rotated 90 deg anticlockwise
1209 #define RCOR_UPSIDEDOWN               3           // rotated 180 deg
1210 #define RCOR_LEFT                         4           // rotated 90 deg clockwise
1211
1212 // RC Preferences:
1213 #define RCP_LEFTHAND                    0x0001  // left handed input
1214 #define RCP_MAPCHAR                     0x0004  // fill in syg.lpsyc (ink) for training
1215
1216 // RCRESULT wResultsType values:
1217 #define RCRT_DEFAULT                    0x0000  // normal ret
1218 #define RCRT_UNIDENTIFIED           0x0001  // result contains unidentified results
1219 #define RCRT_GESTURE                    0x0002  // result is a gesture
1220 #define RCRT_NOSYMBOLMATCH          0x0004  // nothing recognized (no ink match)
1221 #define RCRT_PRIVATE                    0x4000  // recognizer-specific symbol
1222 #define RCRT_NORECOG                    0x8000  // no recog attempted, only data ret
1223 #define RCRT_ALREADYPROCESSED     0x0008  // GestMgr hooked it
1224 #define RCRT_GESTURETRANSLATED  0x0010  // GestMgr translated it to ANSI value
1225 #define RCRT_GESTURETOKEYS          0x0020  // ditto to set of virtual keys
1226
1227 // RC Result Return Mode specification:
1228 #define RRM_STROKE                       0           // return results after each stroke
1229 #define RRM_SYMBOL                       1           // per symbol (e.g. boxed edits)
1230 #define RRM_WORD                          2           // on recog of a word
1231 #define RRM_NEWLINE                     3           // on recog of a line break
1232 #define RRM_COMPLETE                    16          // on PCM_xx specified completion
1233
1234 // SetGlobalRC() API return code flags:
1235 #define SGRC_OK                            0x0000  // no err
1236 #define SGRC_USER                         0x0001  // invalid User name
1237 #define SGRC_PARAMERROR               0x0002  // param error: call ignored
1238 #define SGRC_RC                            0x0004  // supplied RC has errors
1239 #define SGRC_RECOGNIZER               0x0008  // DefRecog name invalid
1240 #define SGRC_DICTIONARY               0x0010  // lpDefDict path invalid
1241 #define SGRC_INIFILE                    0x0020  // error saving to penwin.ini
1242 #define SGRC_NA                            0x8000  // function not available
1243
1244 #endif /*!NOPENRC1 */
1245
1246 //---------------------------------------------------------------------------
1247
1248 #ifndef NOPENTARGET
1249
1250 #define TPT_CLOSEST                     0x0001     // Assign to the closest target
1251 #define TPT_INTERSECTINK             0x0002     // target with intersecting ink
1252 #define TPT_TEXTUAL                     0x0004     // apply textual heuristics
1253 #define TPT_DEFAULT                     (TPT_TEXTUAL | TPT_INTERSECTINK | TPT_CLOSEST)
1254
1255 #endif /*!NOPENTARGET */
1256
1257 //---------------------------------------------------------------------------
1258 #ifndef NOPENVIRTEVENT
1259
1260 // Virtual Event Layer:
1261 #define VWM_MOUSEMOVE                  0x0001
1262 #define VWM_MOUSELEFTDOWN           0x0002
1263 #define VWM_MOUSELEFTUP               0x0004
1264 #define VWM_MOUSERIGHTDOWN          0x0008
1265 #define VWM_MOUSERIGHTUP             0x0010
1266 #endif /*!NOPENVIRTEVENT */
1267
1268 #endif /* RC_INVOKED */  // ... all the way back from definitions:2
1269
1270 /****** Messages and Defines ************************************************/
1271
1272 // Windows Messages WM_PENWINFIRST (0x0380) and WM_PENWINLAST (0x038F)
1273 // are defined in WINDOWS.H and WINMIN.H
1274
1275 //---------------------------------------------------------------------------
1276 #ifndef NOPENMSGS
1277
1278 #ifndef NOPENRC1      // not available in WIN32
1279 #define WM_RCRESULT                     (WM_PENWINFIRST+1)  // 0x381
1280 #define WM_HOOKRCRESULT               (WM_PENWINFIRST+2)  // 0x382
1281 #endif /*!NOPENRC1*/
1282
1283 #define WM_PENMISCINFO                (WM_PENWINFIRST+3)  // 0x383
1284 #define WM_GLOBALRCCHANGE           (WM_PENWINFIRST+3)  // alias
1285
1286 #ifndef NOPENAPPS     // not available in WIN32
1287 #define WM_SKB                              (WM_PENWINFIRST+4)  // 0x384
1288 #endif /*!NOPENAPPS */
1289
1290 #define WM_PENCTL                         (WM_PENWINFIRST+5)  // 0x385
1291 #define WM_HEDITCTL                     (WM_PENWINFIRST+5)  // FBC: alias
1292
1293 // WM_HEDITCTL (WM_PENCTL) wParam options:
1294 #ifndef _WIN32
1295 #define HE_GETRC                          3           // FBC: get RC from HEDIT/BEDIT control
1296 #define HE_SETRC                          4           // FBC: ditto set
1297 #define HE_GETINFLATE                  5           // FBC: get inflate rect
1298 #define HE_SETINFLATE                  6           // FBC: ditto set
1299 #endif //!_WIN32
1300 #define HE_GETUNDERLINE               7           // get underline mode
1301 #define HE_SETUNDERLINE               8           // ditto set
1302 #define HE_GETINKHANDLE               9           // get handle to captured ink
1303 #define HE_SETINKMODE                  10          // begin HEDIT cold recog mode
1304 #define HE_STOPINKMODE                11          // end cold recog mode
1305 #ifndef _WIN32
1306 #define HE_GETRCRESULTCODE          12          // FBC: result of recog after HN_ENDREC
1307 #endif //!_WIN32
1308 #define HE_DEFAULTFONT                13          // switch BEDIT to def font
1309 #define HE_CHARPOSITION               14          // BEDIT byte offset -> char position
1310 #define HE_CHAROFFSET                  15          // BEDIT char position -> byte offset
1311 #define HE_GETBOXLAYOUT               20          // get BEDIT layout
1312 #define HE_SETBOXLAYOUT               21          // ditto set
1313 #ifndef _WIN32
1314 #define HE_GETRCRESULT                22          // FBC: get RCRESULT after HN_RCRESULT
1315 #endif //!_WIN32
1316 #ifdef JAPAN
1317 #define HE_KKCONVERT                    30          // JPN start kana-kanji conversion
1318 #define HE_GETKKCONVERT               31          // JPN get KK state
1319 #define HE_CANCELKKCONVERT          32          // JPN cancel KK conversion
1320 #define HE_FIXKKCONVERT               33          // JPN force KK result
1321 #define HE_GETKKSTATUS                34          // JPN get KK UI state
1322 #define HE_SETCONVERTRANGE          35          // JPN set a range of DCS
1323 #define HE_GETCONVERTRANGE          36          // JPN get a range of DCS
1324 #define HE_PUTCONVERTCHAR           37          // JPN put a char of DCS
1325 #endif //JAPAN
1326 #define HE_ENABLEALTLIST             40          // en/disable dropdown recog alt's
1327 #define HE_SHOWALTLIST                41          // show dropdown (assume enabled)
1328 #define HE_HIDEALTLIST                42          // hide dropdown alternatives
1329 #ifndef JAPAN
1330 #define HE_GETLENSTYPE                43          // get lens type: CWR_ and CWRK_ flags
1331 #define HE_SETLENSTYPE                44          // set lens type: CWR_ and CWRK_ flags
1332 #endif //!JAPAN
1333
1334 #ifdef JAPAN
1335 //------------------------------
1336 // JPN Kana-to-Kanji conversion subfunctions:
1337 #define HEKK_DEFAULT                    0           // def
1338 #define HEKK_CONVERT                    1           // convert in place
1339 #define HEKK_CANDIDATE                2           // start conversion dialog
1340 #define HEKK_DBCSCHAR                  3           // convert to DBCS
1341 #define HEKK_SBCSCHAR                  4           // convert to SBCS
1342 #define HEKK_HIRAGANA                  5           // convert to hiragana
1343 #define HEKK_KATAKANA                  6           // convert to katakana
1344
1345 //------------------------------
1346 // JPN Return value of HE_GETKKSTATUS
1347 #define HEKKR_NOCONVERT               0           // in no  conversion mode
1348 #define HEKKR_PRECONVERT             1           // in pre conversion mode
1349 #define HEKKR_CONVERT                  2           // in mid conversion mode
1350 #endif //JAPAN
1351
1352 // HE_STOPINKMODE (stop cold recog) options:
1353 #define HEP_NORECOG                     0           // don't recog ink
1354 #define HEP_RECOG                         1           // recog ink
1355 #define HEP_WAITFORTAP                2           // recog after tap in window
1356
1357 // WM_PENCTL notifications:
1358 #define HN_ENDREC                         4           // recog complete
1359 #define HN_DELAYEDRECOGFAIL        5           // HE_STOPINKMODE (cold recog) failed
1360 #define HN_RESULT                         20          // HEDIT/BEDIT has received new ink/recognition result
1361 #ifndef _WIN32
1362 #define HN_RCRESULT                     HN_RESULT
1363 #endif //!_WIN32
1364 #ifdef JAPAN
1365 #define HN_ENDKKCONVERT               30          // JPN KK conversion complete
1366 #endif //JAPAN
1367 #define HN_BEGINDIALOG                40          // Lens/EditText/garbage detection dialog
1368                     //  is about to come up on this hedit/bedit
1369 #define HN_ENDDIALOG                    41          // Lens/EditText/garbage detection dialog
1370                     //  has just been destroyed
1371
1372 //------------------------------
1373 #ifndef NOPENIEDIT
1374
1375 // Messages common with other controls:
1376 #define IE_GETMODIFY                (EM_GETMODIFY)      // gets the mod'n (dirty) bit
1377 #define IE_SETMODIFY                (EM_SETMODIFY)      // sets the mod'n (dirty) bit
1378 #define IE_CANUNDO                    (EM_CANUNDO)          // queries whether can undo
1379 #define IE_UNDO                         (EM_UNDO)               // undo
1380 #define IE_EMPTYUNDOBUFFER      (EM_EMPTYUNDOBUFFER) // clears IEDIT undo buffer
1381
1382 #define IE_MSGFIRST                  (WM_USER+150)        // 0x496 == 1174
1383
1384 // IEdit common messages:
1385 #define IE_GETINK                     (IE_MSGFIRST+0)     // gets ink from the control
1386 #define IE_SETINK                     (IE_MSGFIRST+1)     // sets ink into the control
1387 #define IE_GETPENTIP                (IE_MSGFIRST+2)     // gets the cur def ink pentip
1388 #define IE_SETPENTIP                (IE_MSGFIRST+3)     // sets the cur def ink pentip
1389 #define IE_GETERASERTIP           (IE_MSGFIRST+4)     // gets the cur eraser pentip
1390 #define IE_SETERASERTIP           (IE_MSGFIRST+5)     // sets the cur eraser pentip
1391 #define IE_GETBKGND                  (IE_MSGFIRST+6)     // gets the bkgnd options
1392 #define IE_SETBKGND                  (IE_MSGFIRST+7)     // sets the bkgnd options
1393 #define IE_GETGRIDORIGIN          (IE_MSGFIRST+8)     // gets the bkgnd grid origin
1394 #define IE_SETGRIDORIGIN          (IE_MSGFIRST+9)     // sets the bkgnd grid origin
1395 #define IE_GETGRIDPEN               (IE_MSGFIRST+10)  // gets the bkgnd grid pen
1396 #define IE_SETGRIDPEN               (IE_MSGFIRST+11)  // sets the bkgnd grid pen
1397 #define IE_GETGRIDSIZE             (IE_MSGFIRST+12)  // gets the bkgnd grid size
1398 #define IE_SETGRIDSIZE             (IE_MSGFIRST+13)  // sets the bkgnd grid size
1399 #define IE_GETMODE                    (IE_MSGFIRST+14)  // gets the current pen mode
1400 #define IE_SETMODE                    (IE_MSGFIRST+15)  // sets the current pen mode
1401 #define IE_GETINKRECT               (IE_MSGFIRST+16)  // gets the rectbound of the ink
1402
1403 // IEdit-specific messages:
1404 #define IE_GETAPPDATA               (IE_MSGFIRST+34)  // gets the user-defined datum
1405 #define IE_SETAPPDATA               (IE_MSGFIRST+35)  // sets the user-defined data
1406 #define IE_GETDRAWOPTS             (IE_MSGFIRST+36)  // gets the ink draw options
1407 #define IE_SETDRAWOPTS             (IE_MSGFIRST+37)  // sets the ink options
1408 #define IE_GETFORMAT                (IE_MSGFIRST+38)  // gets format of stroke(s)
1409 #define IE_SETFORMAT                (IE_MSGFIRST+39)  // sets format of stroke(s)
1410 #define IE_GETINKINPUT             (IE_MSGFIRST+40)  // gets the ink input option
1411 #define IE_SETINKINPUT             (IE_MSGFIRST+41)  // sets the ink input option
1412 #define IE_GETNOTIFY                (IE_MSGFIRST+42)  // gets the notification bits
1413 #define IE_SETNOTIFY                (IE_MSGFIRST+43)  // sets the notification bits
1414 #define IE_GETRECOG                  (IE_MSGFIRST+44)  // gets recognition options
1415 #define IE_SETRECOG                  (IE_MSGFIRST+45)  // sets recognition options
1416 #define IE_GETSECURITY             (IE_MSGFIRST+46)  // gets the security options
1417 #define IE_SETSECURITY             (IE_MSGFIRST+47)  // sets the security options
1418 #define IE_GETSEL                     (IE_MSGFIRST+48)  // gets sel status of a stroke
1419 #define IE_SETSEL                     (IE_MSGFIRST+49)  // sets sel status of a stroke
1420 #define IE_DOCOMMAND                (IE_MSGFIRST+50)  // send command to IEdit
1421 #define IE_GETCOMMAND               (IE_MSGFIRST+51)  // gets user command
1422 #define IE_GETCOUNT                  (IE_MSGFIRST+52)  // gets count of strks in I-Edit
1423 #define IE_GETGESTURE               (IE_MSGFIRST+53)  // gets details on user gesture
1424 #define IE_GETMENU                    (IE_MSGFIRST+54)  // gets handle to pop-up menu
1425 #define IE_GETPAINTDC               (IE_MSGFIRST+55)  // gets the HDC for painting
1426 #define IE_GETPDEVENT               (IE_MSGFIRST+56)  // gets details of last pd event
1427 #define IE_GETSELCOUNT             (IE_MSGFIRST+57)  // gets count of selected strks
1428 #define IE_GETSELITEMS             (IE_MSGFIRST+58)  // gets indices of all sel strks
1429 #define IE_GETSTYLE                  (IE_MSGFIRST+59)  // gets IEdit control styles
1430
1431 #endif /*!NOPENIEDIT */
1432
1433 //------------------------------
1434 #ifndef NOPENHEDIT
1435
1436 // (H)Edit Control:
1437 // CTLINITHEDIT.dwFlags values
1438 #define CIH_NOGDMSG                  0x0001  // disable garbage detection message box for this edit
1439 #define CIH_NOACTIONHANDLE      0x0002  // disable action handles for this edit
1440 #define CIH_NOEDITTEXT             0x0004  // disable Lens/Edit/Insert text for this edit
1441 #define CIH_NOFLASHCURSOR        0x0008  // don't flash cursor on tap-n-hold in this (h)edit
1442
1443 #endif /* !NOPENHEDIT */
1444
1445 //------------------------------
1446 #ifndef NOPENBEDIT
1447
1448 // Boxed Edit Control:
1449 // box edit alternative list:
1450 #define HEAL_DEFAULT                    -1L        // AltList def value for lParam
1451
1452 // box edit Info:
1453 #define BEI_FACESIZE                    32          // max size of font name, = LF_FACESIZE
1454 #define BEIF_BOXCROSS                  0x0001
1455
1456 // box edit size:
1457 #define BESC_DEFAULT                    0
1458 #define BESC_ROMANFIXED               1
1459 #define BESC_KANJIFIXED               2
1460 #define BESC_USERDEFINED             3
1461
1462 // CTLINITBEDIT.wFlags values
1463 #define CIB_NOGDMSG                  0x0001  // disable garbage detection message box for this bedit
1464 #define CIB_NOACTIONHANDLE      0x0002  // disable action handles for this bedit
1465 #define CIB_NOFLASHCURSOR        0x0004  // don't flash cursor on tap-n-hold in this bedit
1466 #ifdef JAPAN
1467 #define CIB_NOWRITING               0x0010  // disallow pen input into control
1468 #endif // JAPAN
1469
1470 #define BXD_CELLWIDTH                  12
1471 #define BXD_CELLHEIGHT                16
1472 #define BXD_BASEHEIGHT                13
1473 #define BXD_BASEHORZ                    0
1474 #define BXD_MIDFROMBASE               0
1475 #define BXD_CUSPHEIGHT                2
1476 #define BXD_ENDCUSPHEIGHT           4
1477
1478 #define BXDK_CELLWIDTH                32
1479 #define BXDK_CELLHEIGHT               32
1480 #define BXDK_BASEHEIGHT               28
1481 #define BXDK_BASEHORZ                  0
1482 #define BXDK_MIDFROMBASE             0
1483 #define BXDK_CUSPHEIGHT               28
1484 #define BXDK_ENDCUSPHEIGHT          10
1485
1486 #endif /*!NOPENBEDIT */
1487
1488 #define WM_PENMISC                       (WM_PENWINFIRST+6)  // 0x386
1489
1490 // WM_PENMISC message constants:
1491 #define PMSC_BEDITCHANGE             1           // broadcast when BEDIT changes
1492 #ifndef _WIN32
1493 //#define PMSC_PENUICHANGE          2           // JPN broadcast when PENUI changes
1494 //#define PMSC_SUBINPCHANGE        3           // JPN broadcast when SUBINPUT changes
1495 //#define PMSC_KKCTLENABLE          4           // JPN
1496 #endif //!_WIN32
1497 #define PMSC_GETPCMINFO               5           // query the window's PCMINFO
1498 #define PMSC_SETPCMINFO               6           // set the window's PCMINFO
1499 #define PMSC_GETINKINGINFO          7           // query the window's INKINGINFO
1500 #define PMSC_SETINKINGINFO          8           // set the window's INKINGINFO
1501 #define PMSC_GETHRC                     9           // query the window's HRC
1502 #define PMSC_SETHRC                     10          // set the window's HRC
1503 #define PMSC_GETSYMBOLCOUNT        11          // count of symbols in result recd by window
1504 #define PMSC_GETSYMBOLS               12          // ditto symbols
1505 #define PMSC_SETSYMBOLS               13          // ditto set symbols
1506 #define PMSC_LOADPW                     15          // broadcast load state on penwin
1507 #define PMSC_INKSTOP                    16
1508
1509 // PMSCL_xx lParam values for PMSC_LOADPW:
1510 #define PMSCL_UNLOADED                0L          // penwin just unloaded
1511 #define PMSCL_LOADED                    1L          // penwin just loaded
1512 #define PMSCL_UNLOADING               2L          // penwin about to unload
1513
1514 #define WM_CTLINIT                       (WM_PENWINFIRST+7)  // 0x387
1515
1516 // WM_CTLINIT message constants:
1517 #define CTLINIT_HEDIT                  1
1518 #define CTLINIT_BEDIT                  7
1519 #define CTLINIT_IEDIT                  9
1520 #define CTLINIT_MAX                     10
1521
1522 #define WM_PENEVENT                     (WM_PENWINFIRST+8)  // 0x388
1523
1524 // WM_PENEVENT message values for wParam:
1525 #define PE_PENDOWN                       1           // pen tip down
1526 #define PE_PENUP                          2           // pen tip went from down to up
1527 #define PE_PENMOVE                       3           // pen moved without a tip transition
1528 #define PE_TERMINATING                4           // Peninput about to terminate
1529 #define PE_TERMINATED                  5           // Peninput terminated
1530 #define PE_BUFFERWARNING             6           // Buffer half full.
1531 #define PE_BEGININPUT                  7           // begin default input
1532 #define PE_SETTARGETS                  8           // set target data structure (TARGINFO)
1533 #define PE_BEGINDATA                    9           // init message to all targets
1534 #define PE_MOREDATA                     10          // target gets more data
1535 #define PE_ENDDATA                       11          // termination message to all targets
1536 #define PE_GETPCMINFO                  12          // get input collection info
1537 #define PE_GETINKINGINFO             13          // get inking info
1538 #define PE_ENDINPUT                     14          // Input termination message to window
1539                     //  starting default input
1540 #define PE_RESULT                         15          // sent after ProcessHRC but before GetResultsHRC
1541
1542 #endif /*!NOPENMSGS */
1543
1544 /****** Definitions 3: RC compiler excluded ********************************/
1545
1546 #ifndef RC_INVOKED  // ... rest of file of no interest to rc compiler
1547
1548 //////////////////////////////////////////////////////////////////////////////
1549 /****** Macros **************************************************************/
1550
1551 // misc macros:
1552 //---------------------------------------------------------------------------
1553 #ifndef NOPENDRIVER
1554
1555 #define FPenUpX(x)                       ((BOOL)(((x) & BITPENUP) != 0))
1556 #define GetWEventRef()                (LOWORD(GetMessageExtraInfo()))
1557 #endif /*!NOPENDRIVER */
1558
1559 //---------------------------------------------------------------------------
1560 #ifndef NOPENALC
1561
1562 // ALC macros:
1563
1564 #define MpAlcB(lprc,i)                ((lprc)->rgbfAlc[((i) & 0xff) >> 3])
1565 #define MpIbf(i)                          ((BYTE)(1 << ((i) & 7)))
1566 #define SetAlcBitAnsi(lprc,i)     do {MpAlcB(lprc,i) |= MpIbf(i);} while (0)
1567 #define ResetAlcBitAnsi(lprc,i) do {MpAlcB(lprc,i) &= ~MpIbf(i);} while (0)
1568 #define IsAlcBitAnsi(lprc, i)     ((MpAlcB(lprc,i) & MpIbf(i)) != 0)
1569 #endif /*!NOPENALC */
1570
1571 //---------------------------------------------------------------------------
1572 #ifndef NOPENDATA
1573
1574 // draw 2.0 pendata using internal stroke formats:
1575 #define DrawPenDataFmt(hdc, lprect, hpndt)\
1576       DrawPenDataEx(hdc, lprect, hpndt, 0, IX_END, 0, IX_END, NULL, NULL, 0)
1577
1578 #endif /*!NOPENDATA */
1579
1580 //---------------------------------------------------------------------------
1581 #ifndef NOPENHRC
1582
1583 // Handwriting Recognizer:
1584
1585 // Intervals:
1586 // difference of two absolute times (at2 > at1 for positive result):
1587 #define dwDiffAT(at1, at2)\
1588       (1000L*((at2).sec - (at1).sec) - (DWORD)(at1).ms + (DWORD)(at2).ms)
1589
1590 // comparison of two absolute times (TRUE if at1 < at2):
1591 #define FLTAbsTime(at1, at2)\
1592       ((at1).sec < (at2).sec || ((at1).sec == (at2).sec && (at1).ms < (at2).ms))
1593
1594 #define FLTEAbsTime(at1, at2)\
1595       ((at1).sec < (at2).sec || ((at1).sec == (at2).sec && (at1).ms <= (at2).ms))
1596
1597 #define FEQAbsTime(at1, at2)\
1598       ((at1).sec == (at2).sec && (at1).ms == (at2).ms)
1599
1600 // test if abstime is within an interval:
1601 #define FAbsTimeInInterval(at, lpi)\
1602       (FLTEAbsTime((lpi)->atBegin, at) && FLTEAbsTime(at, (lpi)->atEnd))
1603
1604 // test if interval (lpiT) is within an another interval (lpiS):
1605 #define FIntervalInInterval(lpiT, lpiS)\
1606       (FLTEAbsTime((lpiS)->atBegin, (lpiT)->atBegin)\
1607       && FLTEAbsTime((lpiT)->atEnd, (lpiS)->atEnd))
1608
1609 // test if interval (lpiT) intersects another interval (lpiS):
1610 #define FIntervalXInterval(lpiT, lpiS)\
1611       (!(FLTAbsTime((lpiT)->atEnd, (lpiS)->atBegin)\
1612       || FLTAbsTime((lpiS)->atEnd, (lpiT)->atBegin)))
1613
1614 // duration of an LPINTERVAL in ms:
1615 #define dwDurInterval(lpi)  dwDiffAT((lpi)->atBegin, (lpi)->atEnd)
1616
1617 // fill a pointer to an ABSTIME structure from a count of seconds and ms:
1618 #define MakeAbsTime(lpat, sec, ms) do {\
1619       (lpat)->sec = sec + ((ms) / 1000);\
1620       (lpat)->ms = (ms) % 1000;\
1621       } while (0)
1622
1623 // SYV macros:
1624 #define FIsSpecial(syv)               (HIWORD((syv))==SYVHI_SPECIAL)
1625 #define FIsAnsi(syv)                    (HIWORD((syv))==SYVHI_ANSI)
1626 #define FIsGesture(syv)               (HIWORD((syv))==SYVHI_GESTURE)
1627 #define FIsKanji(syv)                  (HIWORD((syv))==SYVHI_KANJI)
1628 #define FIsShape(syv)                  (HIWORD((syv))==SYVHI_SHAPE)
1629 #define FIsUniCode(syv)               (HIWORD((syv))==SYVHI_UNICODE)
1630 #define FIsVKey(syv)                    (HIWORD((syv))==SYVHI_VKEY)
1631
1632 #define ChSyvToAnsi(syv)             ((BYTE) (LOBYTE(LOWORD((syv)))))
1633 #define WSyvToKanji(syv)             ((WORD) (LOWORD((syv))))
1634 #define SyvCharacterToSymbol(c) ((LONG)(unsigned char)(c) | 0x00010000)
1635 #define SyvKanjiToSymbol(c)        ((LONG)(UINT)(c) | 0x00030000)
1636
1637 #define FIsSelectGesture(syv)     \
1638      ((syv) >= SYVSELECTFIRST && (syv) <= SYVSELECTLAST)
1639
1640 #define FIsStdGesture(syv)          \
1641      (                                              \
1642      FIsSelectGesture(syv)             \
1643      || (syv)==SYV_CLEAR                \
1644      || (syv)==SYV_HELP                  \
1645      || (syv)==SYV_EXTENDSELECT     \
1646      || (syv)==SYV_UNDO                  \
1647      || (syv)==SYV_COPY                  \
1648      || (syv)==SYV_CUT                    \
1649      || (syv)==SYV_PASTE                \
1650      || (syv)==SYV_CLEARWORD          \
1651      || (syv)==SYV_KKCONVERT          \
1652      || (syv)==SYV_USER                  \
1653      || (syv)==SYV_CORRECT             \
1654      )
1655
1656 #define FIsAnsiGesture(syv) \
1657      (                                              \
1658      (syv) == SYV_BACKSPACE           \
1659      || (syv) == SYV_TAB                \
1660      || (syv) == SYV_RETURN           \
1661      || (syv) == SYV_SPACE             \
1662      )
1663
1664 #endif /*!NOPENHRC */
1665
1666 //---------------------------------------------------------------------------
1667 #ifndef NOPENINKPUT
1668
1669 #define SubPenMsgFromWpLp(wp, lp)           (LOWORD(wp))
1670 #ifdef _WIN32
1671 #define EventRefFromWpLp(wp, lp)             (HIWORD(wp))
1672 #define TerminationFromWpLp(wp, lp)        ((int)HIWORD(wp))
1673 #define HpcmFromWpLp(wp, lp)                    ((HPCM)(lp))
1674 #else
1675 #define EventRefFromWpLp(wp, lp)             (LOWORD(lp))
1676 #define TerminationFromWpLp(wp, lp)        ((int)LOWORD(lp))
1677 #define HpcmFromWpLp(wp, lp)                    ((HPCM)HIWORD(lp))
1678 #endif //_WIN32
1679
1680 #endif     /*!NOPENINKPUT*/
1681
1682 //---------------------------------------------------------------------------
1683 #ifndef NOPENTARGET
1684 #define HwndFromHtrg(htrg)          ((HWND)(DWORD)(htrg))
1685 #define HtrgFromHwnd(hwnd)          ((HTRG)(UINT)(hwnd))
1686 #endif /*!NOPENTARGET*/
1687
1688 //////////////////////////////////////////////////////////////////////////////
1689 /****** Typedefs ************************************************************/
1690
1691 // Simple:
1692 typedef LONG                                 ALC;      // Enabled Alphabet
1693 typedef int                                   CL;        // Confidence Level
1694 typedef UINT                                 HKP;      // Hook Parameter
1695 typedef int                                   REC;      // recognition result
1696 typedef LONG                                 SYV;      // Symbol Value
1697
1698 #ifndef DECLARE_HANDLE32
1699 #define DECLARE_HANDLE32(name)\
1700       struct name##__ { int unused; };\
1701       typedef const struct name##__ FAR* name
1702 #endif //!DECLARE_HANDLE32
1703
1704 DECLARE_HANDLE32(HTRG);                            // Handle to target
1705 DECLARE_HANDLE(HPCM);                               // Handle to Pen Collection Info
1706 DECLARE_HANDLE(HPENDATA);                         // handle to ink
1707 DECLARE_HANDLE(HREC);                               // handle to recognizer
1708
1709 // Pointer Types:
1710 typedef ALC FAR*                          LPALC;             // ptr to ALC
1711 typedef LPVOID                              LPOEM;             // alias
1712 typedef SYV FAR*                          LPSYV;             // ptr to SYV
1713 typedef HPENDATA FAR*                  LPHPENDATA;     // ptr to HPENDATA
1714
1715 // Function Prototypes:
1716 typedef int               (CALLBACK *ENUMPROC)(LPSYV, int, VOID FAR*);
1717 typedef int               (CALLBACK *LPDF)(int, LPVOID, LPVOID, int, DWORD, DWORD);
1718 typedef BOOL             (CALLBACK *RCYIELDPROC)(VOID);
1719
1720 // Structures:
1721
1722 typedef struct tagABSTIME           // 2.0 absolute date/time
1723      {
1724      DWORD sec;          // number of seconds since 1/1/1970, ret by CRTlib time() fn
1725      UINT ms;             // additional offset in ms, 0..999
1726      }
1727      ABSTIME, FAR *LPABSTIME;
1728
1729 //---------------------------------------------------------------------------
1730 #ifndef NOPENHEDIT
1731
1732 typedef struct tagCTLINITHEDIT  // 2.0 init struct for (h)edit
1733      {
1734      DWORD cbSize;                          // sizeof(CTLINITHEDIT)
1735      HWND hwnd;                               // (h)edit window handle
1736      int id;                                    // its id
1737      DWORD dwFlags;                         // CIE_xx
1738      DWORD dwReserved;                    // for future use
1739      }
1740      CTLINITHEDIT, FAR *LPCTLINITHEDIT;
1741 #endif /* !NOPENHEDIT */
1742
1743 //---------------------------------------------------------------------------
1744 #ifndef NOPENBEDIT
1745
1746 typedef struct tagBOXLAYOUT        // 1.0 box edit layout
1747      {
1748      int cyCusp;                              // pixel height of box (BXS_RECT) or cusp
1749      int cyEndCusp;                         // pixel height of cusps at extreme ends
1750      UINT style;                              // BXS_xx style
1751      DWORD dwReserved1;                  // reserved
1752      DWORD dwReserved2;                  // reserved
1753      DWORD dwReserved3;                  // reserved
1754      }
1755      BOXLAYOUT, FAR *LPBOXLAYOUT;
1756
1757 typedef struct tagCTLINITBEDIT  // 2.0 init struct for box edit
1758      {
1759      DWORD cbSize;                          // sizeof(CTLINITBEDIT)
1760      HWND hwnd;                               // box edit window handle
1761      int id;                                    // its id
1762      WORD wSizeCategory;                // BESC_xx
1763      WORD wFlags;                            // CIB_xx
1764      DWORD dwReserved;                    // for future use
1765      }
1766      CTLINITBEDIT, FAR *LPCTLINITBEDIT;
1767
1768 typedef struct tagBOXEDITINFO     // 1.1 box edit Size Info
1769      {
1770      int cxBox;                               // width of a single box
1771      int cyBox;                               // ditto height
1772      int cxBase;                              // in-box x-margin to guideline
1773      int cyBase;                              // in-box y offset from top to baseline
1774      int cyMid;                               // 0 or distance from baseline to midline
1775      BOXLAYOUT boxlayout;               // embedded BOXLAYOUT structure
1776      UINT wFlags;                            // BEIF_xx
1777      BYTE szFaceName[BEI_FACESIZE];     // font face name
1778      UINT wFontHeight;                    // font height
1779      UINT rgwReserved[8];               // for future use
1780      }
1781      BOXEDITINFO, FAR *LPBOXEDITINFO;
1782 #endif /*!NOPENBEDIT */
1783
1784 //---------------------------------------------------------------------------
1785 #ifndef NOPENCTL
1786
1787 typedef struct tagRECTOFS           // 1.0 rectangle offset for nonisometric inflation
1788      {
1789      int dLeft;                               // inflation leftwards from left side
1790      int dTop;                                 // ditto upwards from top
1791      int dRight;                              // ditto rightwards from right
1792      int dBottom;                            // ditto downwards from bottom
1793      }
1794      RECTOFS, FAR *LPRECTOFS;
1795 #endif /*!NOPENCTL */
1796
1797 //---------------------------------------------------------------------------
1798 #ifndef NOPENDATA
1799
1800 typedef struct tagPENDATAHEADER // 1.0 main pen data header
1801      {
1802      UINT wVersion;                         // pen data format version
1803      UINT cbSizeUsed;                     // size of pendata mem block in bytes
1804      UINT cStrokes;                         // number of strokes (incl up-strokes)
1805      UINT cPnt;                               // count of all points
1806      UINT cPntStrokeMax;                // length (in points) of longest stroke
1807      RECT rectBound;                       // bounding rect of all down points
1808      UINT wPndts;                            // PDTS_xx bits
1809      int  nInkWidth;                       // ink width in pixels
1810      DWORD rgbInk;                          // ink color
1811      }
1812      PENDATAHEADER, FAR *LPPENDATAHEADER, FAR *LPPENDATA;
1813
1814 typedef struct tagSTROKEINFO      // 1.0 stroke header
1815      {
1816      UINT cPnt;                               // count of points in stroke
1817      UINT cbPnts;                            // size of stroke in bytes
1818      UINT wPdk;                               // state of stroke
1819      DWORD dwTick;                          // time at beginning of stroke
1820      }
1821      STROKEINFO, FAR *LPSTROKEINFO;
1822
1823 typedef struct tagPENTIP             // 2.0 Pen Tip characteristics
1824       {
1825       DWORD cbSize;                         // sizeof(PENTIP)
1826       BYTE btype;                            // pen type/nib (calligraphic nib, etc.)
1827       BYTE bwidth;                          // width of Nib (typically == nInkWidth)
1828       BYTE bheight;                         // height of Nib
1829       BYTE bOpacity;                       // 0=transparent, 0x80=hilite, 0xFF=opaque
1830       COLORREF rgb;                         // pen color
1831       DWORD dwFlags;                       // TIP_xx flags
1832       DWORD dwReserved;                  // for future expansion
1833       }
1834       PENTIP, FAR *LPPENTIP;
1835
1836 typedef BOOL (CALLBACK *ANIMATEPROC)(HPENDATA, UINT, UINT, UINT FAR*, LPARAM);
1837
1838 typedef struct tagANIMATEINFO     // 2.0 Animation parameters
1839       {
1840       DWORD cbSize;                         // sizeof(ANIMATEINFO)
1841       UINT uSpeedPct;                     // speed percent to animate at
1842       UINT uPeriodCB;                     // time between calls to callback in ms
1843       UINT fuFlags;                         // animation flags
1844       LPARAM lParam;                       // value to pass to callback
1845       DWORD dwReserved;                  // reserved
1846       }
1847       ANIMATEINFO, FAR *LPANIMATEINFO;
1848 #endif /*!NOPENDATA */
1849
1850 //---------------------------------------------------------------------------
1851 #ifndef NOPENDRIVER
1852
1853 typedef struct tagOEMPENINFO      // 1.0 OEM pen/tablet hdwe info
1854      {
1855      UINT wPdt;                               // pen data type
1856      UINT wValueMax;                       // largest val ret by device
1857      UINT wDistinct;                       // number of distinct readings possible
1858      }
1859      OEMPENINFO, FAR *LPOEMPENINFO;
1860
1861 typedef struct tagPENPACKET        // 1.0 pen packet
1862      {
1863      UINT wTabletX;                         // x in raw coords
1864      UINT wTabletY;                         // ditto y
1865      UINT wPDK;                               // state bits
1866      UINT rgwOemData[MAXOEMDATAWORDS]; // OEM-specific data
1867      }
1868      PENPACKET, FAR *LPPENPACKET;
1869
1870 typedef struct tagOEM_PENPACKET // 2.0
1871      {
1872      UINT wTabletX;                         // x in raw coords
1873      UINT wTabletY;                         // ditto y
1874      UINT wPDK;                               // state bits
1875      UINT rgwOemData[MAXOEMDATAWORDS];  // OEM-specific data
1876      DWORD dwTime;
1877      }
1878       OEM_PENPACKET, FAR *LPOEM_PENPACKET;
1879
1880 typedef struct tagPENINFO           // 1.0 pen/tablet hdwe info
1881      {
1882      UINT cxRawWidth;                     // max x coord and tablet width in 0.001"
1883      UINT cyRawHeight;                    // ditto y, height
1884      UINT wDistinctWidth;               // number of distinct x values tablet ret
1885      UINT wDistinctHeight;             // ditto y
1886      int nSamplingRate;                  // samples / second
1887      int nSamplingDist;                  // min distance to move before generating event
1888      LONG lPdc;                               // Pen Device Capabilities
1889      int cPens;                               // number of pens supported
1890      int cbOemData;                         // width of OEM data packet
1891      OEMPENINFO rgoempeninfo[MAXOEMDATAWORDS]; // supported OEM data types
1892      UINT rgwReserved[7];               // for internal use
1893      UINT fuOEM;                              // which OEM data, timing, PDK_xx to report
1894      }
1895      PENINFO, FAR *LPPENINFO;
1896
1897 typedef struct tagCALBSTRUCT      // 1.0 pen calibration
1898      {
1899      int wOffsetX;
1900      int wOffsetY;
1901      int wDistinctWidth;
1902      int wDistinctHeight;
1903      }
1904      CALBSTRUCT, FAR *LPCALBSTRUCT;
1905
1906 typedef BOOL (CALLBACK *LPFNRAWHOOK)(LPPENPACKET);
1907 #endif /*!NOPENDRIVER */
1908
1909 //---------------------------------------------------------------------------
1910 #ifndef NOPENHRC
1911
1912 // Handwriting Recognizer:
1913
1914 DECLARE_HANDLE32(HRC);                // Handwriting Recognition Context
1915 DECLARE_HANDLE32(HRCRESULT);      // HRC result
1916 DECLARE_HANDLE32(HWL);                // Handwriting wordlist
1917 DECLARE_HANDLE32(HRECHOOK);        // Recognition Result hook handle
1918
1919 typedef HRC                                   FAR *LPHRC;
1920 typedef HRCRESULT                         FAR *LPHRCRESULT;
1921 typedef HWL                                   FAR *LPHWL;
1922
1923 typedef BOOL (CALLBACK *HRCRESULTHOOKPROC)
1924       (HREC, HRC, UINT, UINT, UINT, LPVOID);
1925
1926 // Inksets:
1927 DECLARE_HANDLE(HINKSET);             // handle to an inkset
1928 typedef HINKSET                            FAR* LPHINKSET; // ptr to HINKSET
1929
1930 typedef struct tagINTERVAL          // 2.0 interval structure for inksets
1931       {
1932       ABSTIME atBegin;                    // begining of 1-ms granularity interval
1933       ABSTIME atEnd;                       // 1 ms past end of interval
1934       }
1935       INTERVAL, FAR *LPINTERVAL;
1936
1937 typedef struct tagBOXRESULTS      // 2.0
1938       {
1939       UINT indxBox;
1940       HINKSET hinksetBox;
1941       SYV rgSyv[1];
1942       }
1943       BOXRESULTS, FAR *LPBOXRESULTS;
1944
1945 typedef struct tagGUIDE               // 1.0 guide structure
1946      {
1947      int xOrigin;                            // left edge of first box (screen coord))
1948      int yOrigin;                            // ditto top edge
1949      int cxBox;                               // width of a single box
1950      int cyBox;                               // ditto height
1951      int cxBase;                              // in-box x-margin to guideline
1952      int cyBase;                              // in-box y offset from top to baseline
1953      int cHorzBox;                          // count of boxed columns
1954      int cVertBox;                          // ditto rows
1955      int cyMid;                               // 0 or distance from baseline to midline
1956      }
1957      GUIDE, FAR *LPGUIDE;
1958
1959 #endif /*!NOPENHRC */
1960
1961 //---------------------------------------------------------------------------
1962 #ifndef NOPENIEDIT
1963
1964 typedef struct tagCTLINITIEDIT  // 2.0 init struct for Ink Edit
1965       {
1966       DWORD cbSize;                         // sizeof(CTLINITIEDIT)
1967       HWND hwnd;                              // IEdit window handle
1968       int id;                                   // its ID
1969       WORD ieb;                               // IEB_* (background) bits
1970       WORD iedo;                              // IEDO_* (draw options) bits
1971       WORD iei;                               // IEI_* (ink input) bits
1972       WORD ien;                               // IEN_* (notification) bits
1973       WORD ierec;                            // IEREC_* (recognition) bits
1974       WORD ies;                               // IES_* (style) bits
1975       WORD iesec;                            // IESEC_* (security) bits
1976       WORD pdts;                              // initial pendata scale factor (PDTS_*)
1977       HPENDATA hpndt;                     // initial pendata (or NULL if none)
1978       HGDIOBJ hgdiobj;                    // background brush or bitmap handle
1979       HPEN hpenGrid;                       // pen to use in drawing grid
1980       POINT ptOrgGrid;                    // grid lines point of origin
1981       WORD wVGrid;                          // vertical gridline spacing
1982       WORD wHGrid;                          // horizontal gridline spacing
1983       DWORD dwApp;                          // application-defined data
1984       DWORD dwReserved;                  // reserved for future use
1985       }
1986       CTLINITIEDIT, FAR *LPCTLINITIEDIT;
1987
1988 typedef struct tagPDEVENT           // 2.0
1989       {
1990       DWORD cbSize;                         // sizeof(PDEVENT)
1991       HWND hwnd;                              // window handle of I-Edit
1992       UINT wm;                                 // WM_* (window message) of event
1993       WPARAM wParam;                       // wParam of message
1994       LPARAM lParam;                       // lParam of message
1995       POINT pt;                               // event pt in I-Edit client co-ords
1996       BOOL fPen;                              // TRUE if pen (or other inking device)
1997       LONG lExInfo;                         // GetMessageExtraInfo() return value
1998       DWORD dwReserved;                  // for future use
1999       }
2000       PDEVENT, FAR *LPPDEVENT;
2001
2002 typedef struct tagSTRKFMT           // 2.0
2003       {
2004       DWORD cbSize;                         // sizeof(STRKFMT)
2005       UINT iesf;                              // stroke format flags and return bits
2006       UINT iStrk;                            // stroke index if IESF_STROKE
2007       PENTIP tip;                            // ink tip attributes
2008       DWORD dwUser;                         // user data for strokes
2009       DWORD dwReserved;                  // for future use
2010       }
2011       STRKFMT, FAR *LPSTRKFMT;
2012 #endif /*!NOPENIEDIT */
2013
2014 //---------------------------------------------------------------------------
2015 #ifndef NOPENINKPUT
2016
2017 typedef struct tagPCMINFO           // 2.0 Pen Collection Mode Information
2018      {
2019      DWORD cbSize;                          // sizeof(PCMINFO)
2020      DWORD dwPcm;                            // PCM_xxx flags
2021      RECT rectBound;                       // if finish on pendown outside this rect
2022      RECT rectExclude;                    // if finish on pendown inside this rect
2023      HRGN hrgnBound;                       // if finish on pendown outside this region
2024      HRGN hrgnExclude;                    // if finish on pendown inside this region
2025      DWORD dwTimeout;                     // if finish after timeout, this many ms
2026      }
2027       PCMINFO, FAR *LPPCMINFO;
2028
2029 typedef struct tagINKINGINFO      // 2.0 Pen Inking Information
2030      {
2031      DWORD cbSize;                          // sizeof(INKINGINFO)
2032      UINT wFlags;                            // One of the PII_xx flags
2033      PENTIP tip;                              // Pen type, size and color
2034      RECT rectClip;                         // Clipping rect for the ink
2035      RECT rectInkStop;                    // Rect in which a pen down stops inking
2036      HRGN hrgnClip;                         // Clipping region for the ink
2037      HRGN hrgnInkStop;                    // Region in which a pen down stops inking
2038      }
2039       INKINGINFO, FAR *LPINKINGINFO;
2040 #endif /*!NOPENINKPUT */
2041
2042 //---------------------------------------------------------------------------
2043 #ifndef NOPENRC1      // not available in WIN32
2044
2045 typedef struct tagSYC                  // 1.0 Symbol Correspondence for Ink
2046      {
2047      UINT wStrokeFirst;                  // first stroke, inclusive
2048      UINT wPntFirst;                       // first point in first stroke, inclusive
2049      UINT wStrokeLast;                    // last stroke, inclusive
2050      UINT wPntLast;                         // last point in last stroke, inclusive
2051      BOOL fLastSyc;                         // T: no more SYCs follow for current SYE
2052      }
2053      SYC, FAR *LPSYC;
2054
2055 typedef struct tagSYE                  // 1.0 Symbol Element
2056      {
2057      SYV syv;                                   // symbol value
2058      LONG lRecogVal;                       // for internal use by recognizer
2059      CL cl;                                      // confidence level
2060      int iSyc;                                 // SYC index
2061      }
2062      SYE, FAR *LPSYE;
2063
2064 typedef struct tagSYG                  // 1.0 Symbol Graph
2065      {
2066      POINT rgpntHotSpots[MAXHOTSPOT]; // hot spots (max 8)
2067      int cHotSpot;                          // number of valid hot spots in rgpntHotSpots
2068      int nFirstBox;                         // row-major index to box of 1st char in result
2069      LONG lRecogVal;                       // reserved for use by recoognizer
2070      LPSYE lpsye;                            // nodes of symbol graph
2071      int cSye;                                 // number of SYEs in symbol graph
2072      LPSYC lpsyc;                            // ptr to corresp symbol ink
2073      int cSyc;                                 // ditto count
2074      }
2075      SYG, FAR *LPSYG;
2076
2077 typedef struct tagRC                    // 1.0 Recognition Context (RC)
2078      {
2079      HREC hrec;                               // handle of recognizer to use
2080      HWND hwnd;                               // window to send results to
2081      UINT wEventRef;                       // index into ink buffer
2082      UINT wRcPreferences;               // flags: RCP_xx Preferences
2083      LONG lRcOptions;                     // RCO_xx options
2084      RCYIELDPROC lpfnYield;           // procedure called during Yield()
2085      BYTE lpUser[cbRcUserMax];      // current writer
2086      UINT wCountry;                         // country code
2087      UINT wIntlPreferences;           // flags: RCIP_xx
2088      char lpLanguage[cbRcLanguageMax]; // language strings
2089      LPDF rglpdf[MAXDICTIONARIES];     // list of dictionary functions
2090      UINT wTryDictionary;               // max enumerations to search
2091      CL clErrorLevel;                     // level where recognizer should reject input
2092      ALC alc;                                   // enabled alphabet
2093      ALC alcPriority;                     // prioritizes the ALC_ codes
2094      BYTE rgbfAlc[cbRcrgbfAlcMax];     // bit field for enabled characters
2095      UINT wResultMode;                    // RRM_xx when to send (asap or when complete)
2096      UINT wTimeOut;                         // recognition timeout in ms
2097      LONG lPcm;                               // flags: PCM_xx for ending recognition
2098      RECT rectBound;                       // bounding rect for inking (def:screen coords)
2099      RECT rectExclude;                    // pen down inside this terminates recognition
2100      GUIDE guide;                            // struct: defines guidelines for recognizer
2101      UINT wRcOrient;                       // RCOR_xx orientation of writing wrt tablet
2102      UINT wRcDirect;                       // RCD_xx direction of writing
2103      int nInkWidth;                         // ink width 0 (none) or 1..15 pixels
2104      COLORREF rgbInk;                     // ink color
2105      DWORD dwAppParam;                    // for application use
2106      DWORD dwDictParam;                  // for app use to be passed on to dictionaries
2107      DWORD dwRecognizer;                // for app use to be passed on to recognizer
2108      UINT rgwReserved[cwRcReservedMax]; // reserved for future use by Windows
2109      }
2110      RC, FAR *LPRC;
2111
2112 typedef struct tagRCRESULT          // 1.0 Recognition Result
2113      {
2114      SYG syg;                                   // symbol graph
2115      UINT wResultsType;                  // see RCRT_xx
2116      int cSyv;                                 // count of symbol values
2117      LPSYV lpsyv;                            // NULL-term ptr to recog's best guess
2118      HANDLE hSyv;                            // globally-shared handle to lpsyv mem
2119      int nBaseLine;                         // 0 or baseline of input writing
2120      int nMidLine;                          // ditto midline
2121      HPENDATA hpendata;                  // pen data mem
2122      RECT rectBoundInk;                  // ink data bounds
2123      POINT pntEnd;                          // pt that terminated recog
2124      LPRC lprc;                               // recog context used
2125      }
2126      RCRESULT, FAR *LPRCRESULT;
2127
2128 typedef int               (CALLBACK *LPFUNCRESULTS)(LPRCRESULT, REC);
2129
2130 #endif /*!NOPENRC1 */
2131
2132 //---------------------------------------------------------------------------
2133 #ifndef NOPENTARGET
2134
2135 #ifndef _WIN32
2136 #if (WINVER < 0x0400)
2137 #ifndef _OLE2_H_
2138 typedef struct tagRECTL
2139 {
2140      LONG        left;
2141      LONG        top;
2142      LONG        right;
2143      LONG        bottom;
2144 } RECTL;
2145 typedef RECTL*           PRECTL;
2146 typedef RECTL NEAR*  NPRECTL;
2147 typedef RECTL FAR*     LPRECTL;
2148 typedef const RECTL FAR* LPCRECTL;
2149 #endif // !_OLE2_H_
2150 #endif // WINVER
2151 #endif // !WIN32
2152
2153 typedef struct tagTARGET             // 2.0 Geometry for a single target.
2154      {
2155      DWORD dwFlags;                         // individual target flags
2156      DWORD idTarget;                       // TARGINFO.rgTarget[] index
2157      HTRG  htrgTarget;                    // HANDLE32 equiv
2158      RECTL rectBound;                     // Bounding rect of the target
2159      DWORD dwData;                          // data collection info per target
2160      RECTL rectBoundInk;                // Reserved for internal use, must be zero
2161      RECTL rectBoundLastInk;          // Reserved for internal use, must be zero
2162      }
2163      TARGET, FAR *LPTARGET;
2164
2165 typedef struct tagTARGINFO          // 2.0 A set of targets
2166      {
2167      DWORD cbSize;                          // sizeof(TARGINFO)
2168      DWORD dwFlags;                         // flags
2169      HTRG htrgOwner;                       // HANDLE32 equiv
2170      WORD cTargets;                         // count of targets
2171      WORD iTargetLast;                    // last target, used by TargetPoints API
2172                 // if TPT_TEXTUAL flag is set
2173      TARGET rgTarget[1];                // variable-length array of targets
2174      }
2175      TARGINFO, FAR *LPTARGINFO;
2176
2177 typedef struct tagINPPARAMS        // 2.0
2178      {
2179      DWORD cbSize;                          // sizeof(INPPARAMS)
2180      DWORD dwFlags;
2181      HPENDATA hpndt;
2182      TARGET target;                         // target structure
2183      }
2184       INPPARAMS, FAR *LPINPPARAMS;
2185 #endif /*!NOPENTARGET */
2186
2187 #ifdef JAPAN
2188 typedef struct tagCWX                  // 2.0
2189      {
2190      DWORD cbSize;                          // sizeof(CWXSTRUCT): required entry
2191      WORD wApplyFlags;                    // CWXA_xx apply flags (else use MRU settings)
2192      HWND hwndText;                         // text window if different [NULL=use owner]
2193      HRC hrc;                                   // recognition context [def NULL]
2194      char szCaption[CBCAPTIONCWX];// caption [def {0}]
2195      DWORD dwEditStyle;                  // style for edit control [def 0]
2196      DWORD dwSel;                            // selection [def 0]
2197
2198      // these use Most Recent settings unless corresp [wApplyFlags] bit set:
2199      DWORD dwFlags;                         // CWX_xx context flags [CWXA_CONTEXT]
2200      WORD ixkb;                               // CWXK_xx keyboard [CWXA_KBD]
2201      WORD rgState[CKBCWX];             // array of keyboard states [CWXA_STATE]
2202      POINT ptUL;                              // dlg u.l. corner, screen coords [CWXA_PTUL]
2203      SIZE sizeHW;                            // dlg HW tab size, screen coords [CWXA_SIZE]
2204      }
2205      CWX, FAR *LPCWX;
2206
2207 #endif //JAPAN
2208
2209 //////////////////////////////////////////////////////////////////////////////
2210 /****** APIs and Prototypes *************************************************/
2211
2212 LRESULT CALLBACK      DefPenWindowProc(HWND, UINT, WPARAM, LPARAM);
2213
2214 //---------------------------------------------------------------------------
2215 #ifndef NOPENAPPS     // not available in WIN32
2216
2217 // Pen System Applications:
2218 BOOL          WINAPI ShowKeyboard(HWND, UINT, LPPOINT, LPSKBINFO);
2219
2220 #endif /*!NOPENAPPS */
2221
2222 //---------------------------------------------------------------------------
2223 #ifndef NOPENDATA     // these APIs are implemented in PKPD.DLL
2224
2225 // PenData:
2226 #ifndef NOPENAPIFUN
2227 LPPENDATA WINAPI BeginEnumStrokes(HPENDATA);
2228 LPPENDATA WINAPI EndEnumStrokes(HPENDATA);
2229 HPENDATA  WINAPI CompactPenData(HPENDATA, UINT);
2230 HPENDATA  WINAPI CreatePenData(LPPENINFO, int, UINT, UINT);
2231 VOID          WINAPI DrawPenData(HDC, LPRECT, HPENDATA);
2232 BOOL          WINAPI GetPenDataStroke(LPPENDATA, UINT, LPPOINT FAR*,
2233                   LPVOID FAR*, LPSTROKEINFO);
2234 #endif //!NOPENAPIFUN
2235 HPENDATA  WINAPI AddPointsPenData(HPENDATA, LPPOINT, LPVOID, LPSTROKEINFO);
2236 int           WINAPI CompressPenData(HPENDATA, UINT, DWORD);
2237 HPENDATA  WINAPI CreatePenDataEx(LPPENINFO, UINT, UINT, UINT);
2238 HRGN          WINAPI CreatePenDataRegion(HPENDATA, UINT);
2239 BOOL          WINAPI DestroyPenData(HPENDATA);
2240 int           WINAPI DrawPenDataEx(HDC, LPRECT, HPENDATA, UINT, UINT, UINT, UINT,
2241                        ANIMATEPROC, LPANIMATEINFO, UINT);
2242 HPENDATA  WINAPI DuplicatePenData(HPENDATA, UINT);
2243 int           WINAPI ExtractPenDataPoints(HPENDATA, UINT, UINT, UINT, LPPOINT,
2244                           LPVOID, UINT);
2245 int           WINAPI ExtractPenDataStrokes(HPENDATA, UINT, LPARAM,
2246                            LPHPENDATA, UINT);
2247 int           WINAPI GetPenDataAttributes(HPENDATA, LPVOID, UINT);
2248 BOOL          WINAPI GetPenDataInfo(HPENDATA, LPPENDATAHEADER, LPPENINFO, DWORD);
2249 BOOL          WINAPI GetPointsFromPenData(HPENDATA, UINT, UINT, UINT, LPPOINT);
2250 int           WINAPI GetStrokeAttributes(HPENDATA, UINT, LPVOID, UINT);
2251 int           WINAPI GetStrokeTableAttributes(HPENDATA, UINT, LPVOID, UINT);
2252 int           WINAPI HitTestPenData(HPENDATA, LPPOINT, UINT, UINT FAR*, UINT FAR*);
2253 int           WINAPI InsertPenData(HPENDATA, HPENDATA, UINT);
2254 int           WINAPI InsertPenDataPoints(HPENDATA, UINT, UINT, UINT,
2255                         LPPOINT, LPVOID);
2256 int           WINAPI InsertPenDataStroke(HPENDATA, UINT, LPPOINT, LPVOID,
2257                         LPSTROKEINFO);
2258 BOOL          WINAPI MetricScalePenData(HPENDATA, UINT);
2259 BOOL          WINAPI OffsetPenData(HPENDATA, int, int);
2260 LONG          WINAPI PenDataFromBuffer(LPHPENDATA, UINT, LPBYTE, LONG, LPDWORD);
2261 LONG          WINAPI PenDataToBuffer(HPENDATA, LPBYTE, LONG, LPDWORD);
2262 BOOL          WINAPI RedisplayPenData(HDC, HPENDATA, LPPOINT, LPPOINT,
2263                   int, DWORD);
2264 int           WINAPI RemovePenDataStrokes(HPENDATA, UINT, UINT);
2265 BOOL          WINAPI ResizePenData(HPENDATA, LPRECT);
2266 int           WINAPI SetStrokeAttributes(HPENDATA, UINT, LPARAM, UINT);
2267 int           WINAPI SetStrokeTableAttributes(HPENDATA, UINT, LPARAM, UINT);
2268 int           WINAPI TrimPenData(HPENDATA, DWORD, DWORD);
2269
2270 #endif /*!NOPENDATA */
2271
2272 //---------------------------------------------------------------------------
2273 #ifndef NOPENDICT     // not available in WIN32
2274
2275 // Dictionary:
2276 BOOL          WINAPI DictionarySearch(LPRC, LPSYE, int, LPSYV, int);
2277 #endif /*!NOPENDICT */
2278
2279 //---------------------------------------------------------------------------
2280 #ifndef NOPENDRIVER
2281
2282 // Pen Hardware/Driver:
2283 #ifndef NOPENAPIFUN
2284 BOOL          WINAPI EndPenCollection(REC);
2285 REC           WINAPI GetPenHwData(LPPOINT, LPVOID, int, UINT, LPSTROKEINFO);
2286 REC           WINAPI GetPenHwEventData(UINT, UINT, LPPOINT, LPVOID,
2287                      int, LPSTROKEINFO);
2288 BOOL          WINAPI SetPenHook(HKP, LPFNRAWHOOK);
2289 VOID          WINAPI UpdatePenInfo(LPPENINFO);
2290 #endif //!NOPENAPIFUN
2291 BOOL          WINAPI GetPenAsyncState(UINT);
2292 BOOL          WINAPI IsPenEvent(UINT, LONG);
2293 #endif /*!NOPENDRIVER */
2294
2295 //---------------------------------------------------------------------------
2296 #ifndef NOPENHRC
2297
2298 // Handwriting Recognizer:
2299 int           WINAPI AddPenDataHRC(HRC, HPENDATA);
2300 int           WINAPI AddPenInputHRC(HRC, LPPOINT, LPVOID, UINT, LPSTROKEINFO);
2301 int           WINAPI AddWordsHWL(HWL, LPSTR, UINT);
2302 int           WINAPI ConfigHREC(HREC, UINT, WPARAM, LPARAM);
2303 HRC           WINAPI CreateCompatibleHRC(HRC, HREC);
2304 HWL           WINAPI CreateHWL(HREC, LPSTR, UINT, DWORD);
2305 HINKSET     WINAPI CreateInksetHRCRESULT(HRCRESULT, UINT, UINT);
2306 HPENDATA  WINAPI CreatePenDataHRC(HRC);
2307 int           WINAPI DestroyHRC(HRC);
2308 int           WINAPI DestroyHRCRESULT(HRCRESULT);
2309 int           WINAPI DestroyHWL(HWL);
2310 int           WINAPI EnableGestureSetHRC(HRC, SYV, BOOL);
2311 int           WINAPI EnableSystemDictionaryHRC(HRC, BOOL);
2312 int           WINAPI EndPenInputHRC(HRC);
2313 int           WINAPI GetAlphabetHRC(HRC, LPALC, LPBYTE);
2314 int           WINAPI GetAlphabetPriorityHRC(HRC, LPALC, LPBYTE);
2315 int           WINAPI GetAlternateWordsHRCRESULT(HRCRESULT, UINT, UINT,
2316                           LPHRCRESULT, UINT);
2317 int           WINAPI GetBoxMappingHRCRESULT(HRCRESULT, UINT, UINT, UINT FAR*);
2318 int           WINAPI GetBoxResultsHRC(HRC, UINT, UINT, UINT, LPBOXRESULTS, BOOL);
2319 int           WINAPI GetGuideHRC(HRC, LPGUIDE, UINT FAR*);
2320 int           WINAPI GetHotspotsHRCRESULT(HRCRESULT, UINT, LPPOINT, UINT);
2321 HREC          WINAPI GetHRECFromHRC(HRC);
2322 int           WINAPI GetInternationalHRC(HRC, UINT FAR*, LPSTR, UINT FAR*,
2323                         UINT FAR*);
2324 int           WINAPI GetMaxResultsHRC(HRC);
2325 int           WINAPI GetResultsHRC(HRC, UINT, LPHRCRESULT, UINT);
2326 int           WINAPI GetSymbolCountHRCRESULT(HRCRESULT);
2327 int           WINAPI GetSymbolsHRCRESULT(HRCRESULT, UINT, LPSYV, UINT);
2328 int           WINAPI GetWordlistHRC(HRC, LPHWL);
2329 int           WINAPI GetWordlistCoercionHRC(HRC);
2330 int           WINAPI ProcessHRC(HRC, DWORD);
2331 int           WINAPI ReadHWL(HWL, HFILE);
2332 int           WINAPI SetAlphabetHRC(HRC, ALC, LPBYTE);
2333 int           WINAPI SetAlphabetPriorityHRC(HRC, ALC, LPBYTE);
2334 int           WINAPI SetBoxAlphabetHRC(HRC, LPALC, UINT);
2335 int           WINAPI SetGuideHRC(HRC, LPGUIDE, UINT);
2336 int           WINAPI SetInternationalHRC(HRC, UINT, LPCSTR, UINT, UINT);
2337 int           WINAPI SetMaxResultsHRC(HRC, UINT);
2338 HRECHOOK  WINAPI SetResultsHookHREC(HREC, HRCRESULTHOOKPROC);
2339 int           WINAPI SetWordlistCoercionHRC(HRC, UINT);
2340 int           WINAPI SetWordlistHRC(HRC, HWL);
2341 int           WINAPI TrainHREC(HREC, LPSYV, UINT, HPENDATA, UINT);
2342 int           WINAPI UnhookResultsHookHREC(HREC, HRECHOOK);
2343 int           WINAPI WriteHWL(HWL, HFILE);
2344
2345 // Recognizer Installation:
2346 HREC          WINAPI InstallRecognizer(LPSTR);
2347 VOID          WINAPI UninstallRecognizer(HREC);
2348
2349 // Inksets:
2350 BOOL          WINAPI AddInksetInterval(HINKSET, LPINTERVAL);
2351 HINKSET     WINAPI CreateInkset(UINT);
2352 BOOL          WINAPI DestroyInkset(HINKSET);
2353 int           WINAPI GetInksetInterval(HINKSET, UINT, LPINTERVAL);
2354 int           WINAPI GetInksetIntervalCount(HINKSET);
2355
2356 // Symbol Values:
2357 int           WINAPI CharacterToSymbol(LPSTR, int, LPSYV);
2358 BOOL          WINAPI SymbolToCharacter(LPSYV, int, LPSTR, LPINT);
2359 #endif /*!NOPENHRC */
2360
2361 //---------------------------------------------------------------------------
2362 #ifndef NOPENINKPUT
2363
2364 // Pen Input/Inking:
2365 int           WINAPI DoDefaultPenInput(HWND, UINT);
2366 int           WINAPI GetPenInput(HPCM, LPPOINT, LPVOID, UINT, UINT, LPSTROKEINFO);
2367 int           WINAPI PeekPenInput(HPCM, UINT, LPPOINT, LPVOID, UINT);
2368 int           WINAPI StartInking(HPCM, UINT, LPINKINGINFO);
2369 HPCM          WINAPI StartPenInput(HWND, UINT, LPPCMINFO, LPINT);
2370 int           WINAPI StopInking(HPCM);
2371 int           WINAPI StopPenInput(HPCM, UINT, int);
2372 #endif /*!NOPENINKPUT */
2373
2374 //---------------------------------------------------------------------------
2375 #ifndef NOPENMISC
2376
2377 // Miscellaneous/Utilities:
2378 VOID          WINAPI BoundingRectFromPoints(LPPOINT, UINT, LPRECT);
2379 BOOL          WINAPI DPtoTP(LPPOINT, int);
2380 UINT          WINAPI GetPenAppFlags(VOID);
2381 VOID          WINAPI SetPenAppFlags(UINT, UINT);
2382 LONG          WINAPI GetPenMiscInfo(WPARAM, LPARAM);
2383 UINT          WINAPI GetVersionPenWin(VOID);
2384 LONG          WINAPI SetPenMiscInfo(WPARAM, LPARAM);
2385 BOOL          WINAPI TPtoDP(LPPOINT, int);
2386 BOOL          WINAPI CorrectWriting(HWND, LPSTR, UINT, LPVOID, DWORD, DWORD);
2387 #ifdef JAPAN
2388 int           WINAPI CorrectWritingEx(HWND, LPSTR, UINT, LPCWX);
2389 #endif //JAPAN
2390 #ifdef JAPAN
2391 HANDLE      WINAPI GetPenResource(WPARAM);
2392 #endif //JAPAN
2393 #ifndef _WIN32
2394 UINT          WINAPI IsPenAware(VOID);
2395 VOID          WINAPI RegisterPenApp(UINT, UINT);
2396 #endif //!_WIN32
2397
2398 #endif /*!NOPENMISC */
2399
2400 //---------------------------------------------------------------------------
2401 #ifndef NOPENRC1      // not available in WIN32
2402
2403 // RC1:
2404 VOID          WINAPI EmulatePen(BOOL);
2405 UINT          WINAPI EnumSymbols(LPSYG, UINT, ENUMPROC, LPVOID);
2406 BOOL          WINAPI ExecuteGesture(HWND, SYV, LPRCRESULT);
2407 VOID          WINAPI FirstSymbolFromGraph(LPSYG, LPSYV, int, LPINT);
2408 UINT          WINAPI GetGlobalRC(LPRC, LPSTR, LPSTR, int);
2409 int           WINAPI GetSymbolCount(LPSYG);
2410 int           WINAPI GetSymbolMaxLength(LPSYG);
2411 VOID          WINAPI InitRC(HWND, LPRC);
2412 REC           WINAPI ProcessWriting(HWND, LPRC);
2413 REC           WINAPI Recognize(LPRC);
2414 REC           WINAPI RecognizeData(LPRC, HPENDATA);
2415 UINT          WINAPI SetGlobalRC(LPRC, LPSTR, LPSTR);
2416 BOOL          WINAPI SetRecogHook(UINT, UINT, HWND);
2417 BOOL          WINAPI TrainContext(LPRCRESULT, LPSYE, int, LPSYC, int);
2418 BOOL          WINAPI TrainInk(LPRC, HPENDATA, LPSYV);
2419
2420 // Custom Recognizer functions - not PenWin APIs (formerly in penwoem.h):
2421 VOID          WINAPI CloseRecognizer(VOID);
2422 UINT          WINAPI ConfigRecognizer(UINT, WPARAM, LPARAM);
2423 BOOL          WINAPI InitRecognizer(LPRC);
2424 REC           WINAPI RecognizeDataInternal(LPRC, HPENDATA, LPFUNCRESULTS);
2425 REC           WINAPI RecognizeInternal(LPRC, LPFUNCRESULTS);
2426 BOOL          WINAPI TrainContextInternal(LPRCRESULT, LPSYE, int, LPSYC, int);
2427 BOOL          WINAPI TrainInkInternal(LPRC, HPENDATA, LPSYV);
2428 #endif /*!NOPENRC1 */
2429
2430 //---------------------------------------------------------------------------
2431 #ifndef NOPENTARGET
2432
2433 // Ink Targeting:
2434 int           WINAPI TargetPoints(LPTARGINFO, LPPOINT, DWORD, UINT, LPSTROKEINFO);
2435
2436 #endif /*!NOPENTARGET */
2437
2438 //---------------------------------------------------------------------------
2439 #ifndef NOPENVIRTEVENT
2440
2441 // Virtual Event Layer:
2442 VOID          WINAPI AtomicVirtualEvent(BOOL);
2443 VOID          WINAPI PostVirtualKeyEvent(UINT, BOOL);
2444 VOID          WINAPI PostVirtualMouseEvent(UINT, int, int);
2445 #endif /*!NOPENVIRTEVENT */
2446
2447 //---------------------------------------------------------------------------
2448
2449 #ifdef  JAPAN
2450 // Kanji
2451 BOOL          WINAPI KKConvert(HWND hwndConvert, HWND hwndCaller,
2452                  LPSTR lpBuf, UINT cbBuf, LPPOINT lpPnt);
2453
2454 #endif //  JAPAN
2455
2456 #endif /* RC_INVOKED */ // ... all the way back from definitions:3
2457
2458 /****** End of Header Info *************************************************/
2459
2460 #ifdef __cplusplus
2461 }
2462 #endif /* __cplusplus */
2463
2464 #ifndef _WIN32
2465 #ifndef RC_INVOKED
2466 #pragma pack()
2467 #endif /* RC_INVOKED */
2468 #endif //!_WIN32
2469
2470 #endif /* #define _INC_PENWIN */
2471