?»??»?#ifndef __HCT_H__ #define __HCT_H__ #ifdef __cplusplus extern "C" { #endif typedef DWORD HCTERR; typedef void (*PFNHCTNOTIFY)( UINT nNotify, DWORD dwData ); #ifdef HCT_EXPORTS #define HCTAPI __declspec(dllexport) WINAPI #else #define HCTAPI __declspec(dllimport) WINAPI #endif #define HCT_MAKEVERSION(Major, Minor, Build ) \ MAKELONG( MAKEWORD( 0, Build ), MAKEWORD( Minor, Major )) #define HCT_VERSION HCT_MAKEVERSION( 1, 1, 19 ) //the PNTRoute version #define IN #define OUT // Port specfications #define HCT_PORT_USB ((unsigned) -1) #define HCT_PORT_NONE 0x0 #define HCT_PORT_COM1 0x1 #define HCT_PORT_COM2 0x2 #define HCT_PORT_COM3 0x3 #define HCT_PORT_COM4 0x4 #define HCT_PORT_COM5 0x5 #define HCT_PORT_COM6 0x6 #define HCT_PORT_COM7 0x7 #define HCT_PORT_COM8 0x8 #define HCT_ISPENEVENT(x) ((((x) >= HCT_EVT_PENEVENTS_BEGIN) && \ ((x) <= HCT_EVT_PENEVENTS_END)) ? TRUE : FALSE ) // Event related macros #define HCT_EVT_PENEVENTS_BEGIN 0x0001 #define HCT_EVT_PENDOWN 0x0001 #define HCT_EVT_PENMOVE 0x0002 #define HCT_EVT_PENUP 0x0003 #define HCT_EVT_PENEVENTS_END 0x0007 #define HCT_EVT_LOWSIGNAL 0x0008 #define HCT_EVT_COLOR 0x0009 #define HCT_EVT_BATTERYSTATUS 0x0010 #define HCT_EVT_VBUTTONDOWN 0x0011 #define HCT_EVT_CONNECT 0x0012 #define HCT_EVT_DISCONNECT 0x0013 #define HCT_EVT_LOSTFOCUS 0x0014 #define HCT_EVT_SETFOCUS 0x0015 #define HCT_EVT_PORTCHANGED 0x0016 #define HCT_EVT_MNTINDRAWING 0x0017 // HctPortOpen Flags #define HCT_PORTOPENFLAG_AUTODETECT 0x100 #define HCT_PORTOPENFLAG_LASTPORT 0x200 // Get/Set Parameters #define HCT_PARAM_VBUTTON 0x001 // Virtual Button enable #define HCT_PARAM_PORT 0x002 // Used port #define HCT_PARAM_BATTERYSTATUS 0x003 // Battery Status #define HCT_PARAM_FIRMWARE 0x004 // Firmware version // HCT_EVT_BATTERYSTATUS XPos Parameter #define HCT_BS_LOW 0x00 #define HCT_BS_NORMAL 0x0F // Set Parameters values #define HCT_PARAM_ENABLEVBUTTONS 1 #define HCT_ERR_SEVERITY ((ULONG) 3 << 30) // Bits 30 and 31 #define HCT_ERR_FACILITY 0x100 #define HCT_ERR_CUSTOMBIT ((ULONG) 1 << 29) // Bit 29 #define HCT_ERR_BASE (((ULONG)HCT_ERR_FACILITY << 16) | HCT_ERR_CUSTOMBIT | HCT_ERR_SEVERITY) // Error Codes #define HCT_ERR_SUCCESS 0x0 #define HCT_ERR_GENERALERROR (HCT_ERR_BASE + 0x00) #define HCT_ERR_INVALIDPARAM (HCT_ERR_BASE + 0x01) #define HCT_ERR_UNABLETOOPENPORT (HCT_ERR_BASE + 0x02) #define HCT_ERR_SERVERNOTRESPONDING (HCT_ERR_BASE + 0x03) #define HCT_ERR_PORTALREADYOPEN (HCT_ERR_BASE + 0x04) #define HCT_ERR_INSUFFICIENTBUFFERSIZE (HCT_ERR_BASE + 0x05) #define HCT_ERR_UNSUPPORTEDDEVICEFOUND (HCT_ERR_BASE + 0x06) #define HCT_ERR_MNTINDRAWING (HCT_ERR_BASE + 0x07) #define HCT_ERR_USERCANCELED (HCT_ERR_BASE + 0x08) #define HCT_ERR_NOTINITIALIZED (HCT_ERR_BASE + 0x09) #define HCT_ERR_NOMOREEVENTS (HCT_ERR_BASE + 0x40) #define HCT_WRN_HARDWARENOTDETECTED (HCT_ERR_BASE + 0x81) #define HCT_ERR_NOTSUPPORTED (HCT_ERR_BASE + 0xFF) // Smoothing (HCTSmoothStroke() flags) #define HCT_SMOOTH_IIR 1 #define HCT_SMOOTH_ADDDOTS 2 #define HCT_SMOOTH_BIGXY 4 #define HCT_SMOOTH_BEST (HCT_SMOOTH_IIR | HCT_SMOOTH_ADDDOTS | HCT_SMOOTH_BIGXY) // For future use: Do not use _ALL, Use HCT_SMOOTH_BEST to apply best result. #define HCT_SMOOTH_ALL (HCT_SMOOTH_IIR | HCT_SMOOTH_ADDDOTS | HCT_SMOOTH_BIGXY) // Denotes an invalid Receiver ID number #define RID_INVALID ((RECEIVERID) (-1)) typedef struct { DWORD dwSize; DWORD dwFlags; DWORD Reserved1; DWORD Reserved2; PFNHCTNOTIFY pfnHCTNotify; DWORD uMessage; HWND hWnd; } HCTRECEIVER;//, *PHCTRECEIVER; typedef struct { USHORT uEvent; SHORT XPos; SHORT YPos; } HCTEVENT, *PHCTEVENT; typedef struct { IN DWORD dwSize; // Set to sizeof(HCTVERSION) OUT DWORD dwHctVer; // HCTVersion OUT DWORD dwProductId; // Product Identifier OUT DWORD dwFirmwareVer; // Firmware Version OUT DWORD dwPadVer; // PCNTPad Version } HCTVERSION_V1, *PHCTVERSION_V1; typedef struct { IN DWORD dwSize; // Set to sizeof(HCTVERSION) OUT DWORD dwHctVer; // HCTVersion OUT DWORD dwProductId; // Product Identifier OUT DWORD dwFirmwareVer; // Firmware Version OUT DWORD dwPadVer; // PCNTPad Version OUT DWORD dwAnalogProductId; // Analog Product Identifier OUT DWORD dwAnalogFirmwareVer; // Analog Version } HCTVERSION_V2, *PHCTVERSION_V2; #define HCTVERSION HCTVERSION_V2 #define PHCTVERSION PHCTVERSION_V2 //Flags for RECEIVERINFO #define HCT_RECEIVERFLAG_DEFAULT 0x1 struct RECEIVERINFO { DWORD dwSize; // Set to structure size DWORD dwFlags; HWND hWnd; // Notification Window UINT uMessage; // Using message number }; typedef DWORD RECEIVERID; #define HCT_RID_INVALID ((RECEIVERID) -1) // Prototypes // Initiailizations HCTERR HCTAPI HCTInitEx (DWORD IN Version); HCTERR HCTAPI HCTClose (); // Ports HCTERR HCTAPI HCTPortOpen ( IN DWORD uPort, IN DWORD dwFlags, DWORD dwReserved ); HCTERR HCTAPI HCTPortClose (); BOOL HCTAPI HCTIsConnected (); // Registration HCTERR HCTAPI HCTRegisterReceiver ( IN RECEIVERINFO *pReceiver, OUT RECEIVERID *pRID ); HCTERR HCTAPI HCTUnregisterReceiver ( IN RECEIVERID rid ); // Focus RECEIVERID HCTAPI HCTGetFocus (); HCTERR HCTAPI HCTSetFocus ( IN RECEIVERID rid ); HCTERR HCTAPI HCTRemoveFocus ( IN RECEIVERID rid ); // Events HCTERR HCTAPI HCTGetEvent ( IN RECEIVERID rid, OUT HCTEVENT *pEvt ); HCTERR HCTAPI HCTGetEvents ( IN RECEIVERID rid, OUT HCTEVENT *pEvt, IN OUT UINT *nCount ); // Miscellenous HCTERR HCTAPI HCTGetVersion( IN OUT PHCTVERSION pHctVer ); HCTERR HCTAPI HCTGetParameter (IN RECEIVERID rid,IN UINT uParam, OUT DWORD *pValue ); HCTERR HCTAPI HCTSetParameter (IN RECEIVERID rid,IN UINT uParam, IN DWORD value ); HCTERR HCTAPI HCTSmoothStroke ( IN POINT *pInStroke, IN UINT nInCount, IN OUT POINT *pOutStroke, IN OUT UINT *pnOutCount, DWORD dwFlags ); #ifdef __cplusplus } // extern "C" #endif #endif // __HCT_H__