📄 penwin.h
字号:
/*****************************************************************************\
* *
* penwin.h - Pen Windows functions, types, and definitions *
* *
* Version 1.0 *
* *
\*****************************************************************************/
#ifndef __PENWIN_H /* prevent multiple includes */
#define __PENWIN_H
#ifndef __WINDOWS_H
#include <windows.h> /* <windows.h> must be included */
#endif /* __WINDOWS_H */
#ifndef RC_INVOKED
#pragma option -a- /* Assume byte packing throughout */
#endif /* RC_INVOKED */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* If included with the 3.0 windows.h, define compatible aliases */
#if !defined(WINVER) || (WINVER < 0x030a)
#define CALLBACK FAR PASCAL
#define UINT WORD
#define WINAPI FAR PASCAL
#define LPARAM LONG
#define WPARAM WORD
#endif /* WIN3.0 */
/****** General Pen Windows Definitions *************************************/
typedef int REC;
typedef LONG SYV;
typedef SYV FAR *LPSYV;
typedef HANDLE HREC;
typedef int CL;
typedef LONG ALC;
typedef UINT HKP;
typedef int (CALLBACK * LPDF)(int, LPVOID, LPVOID, int, DWORD, DWORD);
#define BITPENUP 0x8000
#define FPenUpX(x) (((x) & BITPENUP)!=0)
/* Default pen cursor to indicate writing, points northwest */
#define IDC_PEN MAKEINTRESOURCE(32631)
/* alternate select cursor: upsidedown standard arrow, points southeast */
#define IDC_ALTSELECT MAKEINTRESOURCE(32501)
#define RC_WDEFAULT (0xFFFF)
#define RC_LDEFAULT (0xFFFFFFFFL)
#define RC_WDEFAULTFLAGS (0x8000)
#define RC_LDEFAULTFLAGS (0x80000000L)
/* HIWORD(SYV) defines and detection macros */
#define SYVHI_SPECIAL 0
#define FIsSpecial(syv) (HIWORD((syv))==SYVHI_SPECIAL)
#define SYVHI_ANSI 1
#define FIsAnsi(syv) (HIWORD((syv))==SYVHI_ANSI)
#define SYVHI_GESTURE 2
#define FIsGesture(syv) (HIWORD((syv))==SYVHI_GESTURE)
#define SYVHI_KANJI 3
#define FIsKanji(syv) (HIWORD((syv))==SYVHI_KANJI)
#define SYVHI_SHAPE 4
#define FIsShape(syv) (HIWORD((syv))==SYVHI_SHAPE)
#define SYVHI_UNICODE 5
#define FIsUniCode(syv) (HIWORD((syv))==SYVHI_UNICODE)
#define SYVHI_VKEY 6
#define FIsVKey(syv) (HIWORD((syv))==SYVHI_VKEY)
/* Macros to convert between SYV and ANSI */
#define ChSyvToAnsi(syv) ((BYTE) (LOBYTE(LOWORD((syv)))))
#define SyvCharacterToSymbol(c) ((LONG)(unsigned char)(c) | 0x00010000)
#define SyvKanjiToSymbol(c) ((LONG)(WORD)(c) | 0x00030000)
/* SYV values with special meanings to Pen Windows */
#define SYV_NULL 0x00000000L
#define SYV_UNKNOWN 0x00000001L
#define SYV_EMPTY 0x00000003L
#define SYV_BEGINOR 0x00000010L
#define SYV_ENDOR 0x00000011L
#define SYV_OR 0x00000012L
#define SYV_SOFTNEWLINE 0x00000020L
#define SYV_SPACENULL SyvCharacterToSymbol('\0')
/* SYV values for gestures (map into UNICODE space) */
#define SYV_KKCONVERT 0x0002FFD4L
#define SYV_CLEAR 0x0002FFD5L
#define SYV_EXTENDSELECT 0x0002FFD8L
#define SYV_UNDO 0x0002FFD9L
#define SYV_COPY 0x0002FFDAL
#define SYV_CUT 0x0002FFDBL
#define SYV_PASTE 0x0002FFDCL
#define SYV_CLEARWORD 0x0002FFDDL
#define SYV_USER 0x0002FFDEL /* ;Reserved */
#define SYV_CORRECT 0x0002FFDFL
#define SYV_BACKSPACE 0x00020008L
#define SYV_TAB 0x00020009L
#define SYV_RETURN 0x0002000DL
#define SYV_SPACE 0x00020020L
#define FIsStdGesture(syv) \
((syv) == SYV_CLEAR \
|| (syv) == SYV_EXTENDSELECT\
|| (syv) == SYV_UNDO \
|| (syv) == SYV_COPY \
|| (syv) == SYV_CUT \
|| (syv) == SYV_PASTE \
|| (syv) == SYV_CLEARWORD \
|| (syv) == SYV_KKCONVERT \
|| (syv) == SYV_USER \
|| (syv) == SYV_CORRECT)
#define FIsAnsiGesture(syv) \
((syv) == SYV_BACKSPACE \
|| (syv) == SYV_TAB \
|| (syv) == SYV_RETURN \
|| (syv) == SYV_SPACE)
/* Application specific gestures, Circle a-z and Circle A-Z */
#define SYV_APPGESTUREMASK 0x00020000L
#define SYV_CIRCLEUPA 0x000224B6L
#define SYV_CIRCLEUPZ 0x000224CFL
#define SYV_CIRCLELOA 0x000224D0L
#define SYV_CIRCLELOZ 0x000224E9L
/* Gesture Macros */
#define FIsLoAppGesture(syv) (syv >= SYV_CIRCLELOA && syv <= SYV_CIRCLELOZ)
#define FIsUpAppGesture(syv) (syv >= SYV_CIRCLEUPA && syv <= SYV_CIRCLEUPZ)
#define FIsAppGesture(syv) (syv>=SYV_CIRCLEUPA && syv<=SYV_CIRCLELOZ)
#define SyvAppGestureFromLoAnsi(ansi) ((DWORD)(BYTE)ansi- 'a' + SYV_CIRCLELOA)
#define SyvAppGestureFromUpAnsi(ansi) ((DWORD)(BYTE)ansi- 'A' + SYV_CIRCLEUPA)
#define AnsiFromSyvAppGesture(syv) ChSyvToAnsi( \
syv-(FIsUpAppGesture(syv)? SYV_CIRCLEUPA-(SYV)'A': SYV_CIRCLELOA-(SYV)'a'))
/* SYV definitions for shapes */
#define SYV_SHAPELINE 0x00040001L
#define SYV_SHAPEELLIPSE 0x00040002L
#define SYV_SHAPERECT 0x00040003L
#define SYV_SHAPEMIN SYV_SHAPELINE
#define SYV_SHAPEMAX SYV_SHAPERECT
/****** Recognition Error Codes *********************************************/
#define REC_OEM (-1024)
#define REC_LANGUAGE (-48)
#define REC_GUIDE (-47)
#define REC_PARAMERROR (-46)
#define REC_INVALIDREF (-45)
#define REC_RECTEXCLUDE (-44)
#define REC_RECTBOUND (-43)
#define REC_PCM (-42)
#define REC_RESULTMODE (-41)
#define REC_HWND (-40)
#define REC_ALC (-39)
#define REC_ERRORLEVEL (-38)
#define REC_CLVERIFY (-37)
#define REC_DICT (-36)
#define REC_HREC (-35)
#define REC_BADEVENTREF (-33)
#define REC_NOCOLLECTION (-32)
#define REC_DEBUG (-32)
#define REC_POINTEREVENT (-31)
#define REC_BADHPENDATA (-9)
#define REC_OOM (-8)
#define REC_NOINPUT (-7)
#define REC_NOTABLET (-6)
#define REC_BUSY (-5)
#define REC_BUFFERTOOSMALL (-4)
#define REC_ABORT (-3)
#define REC_OVERFLOW (-1)
#define REC_OK 0
#define REC_TERMBOUND 1
#define REC_TERMEX 2
#define REC_TERMPENUP 3
#define REC_TERMRANGE 4
#define REC_TERMTIMEOUT 5
#define REC_DONE 6
#define REC_TERMOEM 512
/****** Pen Driver Structures and Entry points ******************************/
typedef struct tagOEMPENINFO
{
UINT wPdt;
UINT wValueMax;
UINT wDistinct;
}
OEMPENINFO, FAR *LPOEMPENINFO;
#define PDT_NULL 0
#define PDT_PRESSURE 1
#define PDT_HEIGHT 2
#define PDT_ANGLEXY 3
#define PDT_ANGLEZ 4
#define PDT_BARRELROTATION 5
#define PDT_OEMSPECIFIC 16
#define MAXOEMDATAWORDS 6
typedef struct tagPENPACKET
{
UINT wTabletX;
UINT wTabletY;
UINT wPDK;
UINT rgwOemData[MAXOEMDATAWORDS];
}
PENPACKET, FAR *LPPENPACKET;
typedef BOOL (CALLBACK * LPFNRAWHOOK)(LPPENPACKET);
typedef struct tagPENINFO
{
UINT cxRawWidth;
UINT cyRawHeight;
UINT wDistinctWidth;
UINT wDistinctHeight;
int nSamplingRate;
int nSamplingDist;
LONG lPdc;
int cPens;
int cbOemData;
OEMPENINFO rgoempeninfo[MAXOEMDATAWORDS];
UINT rgwReserved[8];
}
PENINFO, FAR *LPPENINFO;
#define PDC_INTEGRATED 0x00000001L
#define PDC_PROXIMITY 0x00000002L
#define PDC_RANGE 0x00000004L
#define PDC_INVERT 0x00000008L
#define PDC_RELATIVE 0x00000010L
#define PDC_BARREL1 0x00000020L
#define PDC_BARREL2 0x00000040L
#define PDC_BARREL3 0x00000080L
typedef struct tagSTROKEINFO
{
UINT cPnt;
UINT cbPnts;
UINT wPdk;
DWORD dwTick;
}
STROKEINFO, FAR *LPSTROKEINFO;
typedef struct tagCALBSTRUCT
{
int wOffsetX;
int wOffsetY;
int wDistinctWidth;
int wDistinctHeight;
}
CALBSTRUCT, FAR *LPCALBSTRUCT;
/****** DRV_ values for pen driver specific messages ************************/
#define DRV_SetPenDriverEntryPoints DRV_RESERVED+1
#define DRV_RemovePenDriverEntryPoints DRV_RESERVED+2
#define DRV_SetPenSamplingRate DRV_RESERVED+3
#define DRV_SetPenSamplingDist DRV_RESERVED+4
#define DRV_GetName DRV_RESERVED+5
#define DRV_GetVersion DRV_RESERVED+6
#define DRV_GetPenInfo DRV_RESERVED+7
#define DRV_GetCalibration DRV_RESERVED+11
#define DRV_SetCalibration DRV_RESERVED+12
VOID WINAPI UpdatePenInfo(LPPENINFO);
BOOL WINAPI EndPenCollection(REC);
REC WINAPI GetPenHwData(LPPOINT, LPVOID, int, UINT, LPSTROKEINFO);
REC WINAPI GetPenHwEventData(UINT, UINT, LPPOINT, LPVOID, int, LPSTROKEINFO);
VOID WINAPI PenPacket(VOID);
BOOL WINAPI SetPenHook(HKP, LPFNRAWHOOK);
/****** Pen Hardware Constants **********************************************/
#define PDK_UP 0x0000
#define PDK_DOWN 0x0001
#define PDK_BARREL1 0x0002
#define PDK_BARREL2 0x0004
#define PDK_BARREL3 0x0008
#define PDK_TRANSITION 0x0010
#define PDK_INVERTED 0x0080
#define PDK_OUTOFRANGE 0x4000
#define PDK_DRIVER 0x8000
#define PDK_TIPMASK 0x0001
#define PDK_SWITCHES (PDK_DOWN|PDK_BARREL1|PDK_BARREL2|PDK_BARREL3)
#define PCM_PENUP 0x00000001L
#define PCM_RANGE 0x00000002L
#define PCM_INVERT 0x00000020L
#define PCM_RECTEXCLUDE 0x00002000L
#define PCM_RECTBOUND 0x00004000L
#define PCM_TIMEOUT 0x00008000L
#define PCM_ADDDEFAULTS RC_LDEFAULTFLAGS /* 0x80000000L */
/****** Virtual Event Layer *************************************************/
VOID WINAPI PostVirtualKeyEvent(UINT, BOOL);
VOID WINAPI PostVirtualMouseEvent(UINT, int, int);
VOID WINAPI AtomicVirtualEvent(BOOL);
#define VWM_MOUSEMOVE 0x0001
#define VWM_MOUSELEFTDOWN 0x0002
#define VWM_MOUSELEFTUP 0x0004
#define VWM_MOUSERIGHTDOWN 0x0008
#define VWM_MOUSERIGHTUP 0x0010
/****** RC Definition *************************************************************/
#define CL_NULL 0
#define CL_MINIMUM 1
#define CL_MAXIMUM 100
#define INKWIDTH_MINIMUM 0
#define INKWIDTH_MAXIMUM 15
#define ENUM_MINIMUM 1
#define ENUM_MAXIMUM 4096
#define MAXDICTIONARIES 16
typedef struct tagGUIDE
{
int xOrigin;
int yOrigin;
int cxBox;
int cyBox;
int cxBase;
int cyBase;
int cHorzBox;
int cVertBox;
int cyMid;
}
GUIDE, FAR *LPGUIDE;
typedef BOOL (CALLBACK * RCYIELDPROC)(VOID);
#define cbRcLanguageMax 44
#define cbRcUserMax 32
#define cbRcrgbfAlcMax 32
#define cwRcReservedMax 8
typedef struct tagRC
{
HREC hrec;
HWND hwnd;
UINT wEventRef;
UINT wRcPreferences;
LONG lRcOptions;
RCYIELDPROC lpfnYield;
BYTE lpUser[cbRcUserMax];
UINT wCountry;
UINT wIntlPreferences;
char lpLanguage[cbRcLanguageMax];
LPDF rglpdf[MAXDICTIONARIES];
UINT wTryDictionary;
CL clErrorLevel;
ALC alc;
ALC alcPriority;
BYTE rgbfAlc[cbRcrgbfAlcMax];
UINT wResultMode;
UINT wTimeOut;
LONG lPcm;
RECT rectBound;
RECT rectExclude;
GUIDE guide;
UINT wRcOrient;
UINT wRcDirect;
int nInkWidth;
COLORREF rgbInk;
DWORD dwAppParam;
DWORD dwDictParam;
DWORD dwRecognizer;
UINT rgwReserved[cwRcReservedMax];
}
RC, FAR *LPRC;
typedef HANDLE HPENDATA;
typedef struct tagSYC
{
UINT wStrokeFirst;
UINT wPntFirst;
UINT wStrokeLast;
UINT wPntLast;
BOOL fLastSyc;
}
SYC, FAR *LPSYC;
#define wPntAll (UINT)0xFFFF
#define iSycNull (-1)
typedef struct tagSYE
{
SYV syv;
LONG lRecogVal;
CL cl;
int iSyc;
}
SYE, FAR *LPSYE;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -