*/}}

wintab_utils.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*----------------------------------------------------------------------------s
  2. NAME
  3. Utils.h
  4. PURPOSE
  5. Defines for the general-purpose functions for the WinTab demos.
  6. COPYRIGHT
  7. This file is Copyright (c) Wacom Company, Ltd. 2020 All Rights Reserved
  8. with portions copyright 1991-1998 by LCS/Telegraphics.
  9. The text and information contained in this file may be freely used,
  10. copied, or distributed without compensation or licensing restrictions.
  11. ---------------------------------------------------------------------------- */
  12. #pragma once
  13. #include <windows.h>
  14. #include <stdio.h>
  15. #include <assert.h>
  16. #include <stdarg.h>
  17. #include "wintab.h"
  18. #ifndef bool
  19. #define bool int
  20. #endif
  21. //////////////////////////////////////////////////////////////////////////////
  22. #define WACOM_DEBUG
  23. // Ignore warnings about using unsafe string functions.
  24. #pragma warning( disable : 4996 )
  25. //////////////////////////////////////////////////////////////////////////////
  26. // Function pointers to Wintab functions exported from wintab32.dll.
  27. typedef UINT(API* WTINFOA) (UINT, UINT, LPVOID);
  28. typedef HCTX(API* WTOPENA)(HWND, LPLOGCONTEXTA, bool);
  29. typedef bool (API* WTGETA) (HCTX, LPLOGCONTEXT);
  30. typedef bool (API* WTSETA) (HCTX, LPLOGCONTEXT);
  31. typedef bool (API* WTCLOSE) (HCTX);
  32. typedef bool (API* WTENABLE) (HCTX, bool);
  33. typedef bool (API* WTPACKET) (HCTX, UINT, LPVOID);
  34. typedef bool (API* WTOVERLAP) (HCTX, bool);
  35. typedef bool (API* WTSAVE) (HCTX, LPVOID);
  36. typedef bool (API* WTCONFIG) (HCTX, HWND);
  37. typedef HCTX(API* WTRESTORE) (HWND, LPVOID, bool);
  38. typedef bool (API* WTEXTSET) (HCTX, UINT, LPVOID);
  39. typedef bool (API* WTEXTGET) (HCTX, UINT, LPVOID);
  40. typedef bool (API* WTQUEUESIZESET) (HCTX, int);
  41. typedef int (API* WTDATAPEEK) (HCTX, UINT, UINT, int, LPVOID, LPINT);
  42. typedef int (API* WTPACKETSGET) (HCTX, int, LPVOID);
  43. typedef HMGR(API* WTMGROPEN) (HWND, UINT);
  44. typedef bool (API* WTMGRCLOSE) (HMGR);
  45. typedef HCTX(API* WTMGRDEFCONTEXT) (HMGR, bool);
  46. typedef HCTX(API* WTMGRDEFCONTEXTEX) (HMGR, UINT, bool);
  47. // TODO - add more wintab32 function defs as needed
  48. //////////////////////////////////////////////////////////////////////////////
  49. extern char* gpszProgramName;
  50. // Loaded Wintab32 API functions.
  51. extern HINSTANCE ghWintab;
  52. extern WTINFOA gpWTInfoA;
  53. extern WTOPENA gpWTOpenA;
  54. extern WTGETA gpWTGetA;
  55. extern WTSETA gpWTSetA;
  56. extern WTCLOSE gpWTClose;
  57. extern WTPACKET gpWTPacket;
  58. extern WTENABLE gpWTEnable;
  59. extern WTOVERLAP gpWTOverlap;
  60. extern WTSAVE gpWTSave;
  61. extern WTCONFIG gpWTConfig;
  62. extern WTRESTORE gpWTRestore;
  63. extern WTEXTSET gpWTExtSet;
  64. extern WTEXTGET gpWTExtGet;
  65. extern WTQUEUESIZESET gpWTQueueSizeSet;
  66. extern WTDATAPEEK gpWTDataPeek;
  67. extern WTPACKETSGET gpWTPacketsGet;
  68. extern WTMGROPEN gpWTMgrOpen;
  69. extern WTMGRCLOSE gpWTMgrClose;
  70. extern WTMGRDEFCONTEXT gpWTMgrDefContext;
  71. extern WTMGRDEFCONTEXTEX gpWTMgrDefContextEx;
  72. // TODO - add more wintab32 function pointers as needed
  73. //////////////////////////////////////////////////////////////////////////////
  74. bool LoadWintab(void);
  75. void UnloadWintab(void);
  76. void ShowError(char* pszErrorMessage);
  77. //////////////////////////////////////////////////////////////////////////////
  78. #ifdef WACOM_DEBUG
  79. void WacomTrace(char* lpszFormat, ...);
  80. #define WACOM_ASSERT( x ) assert( x )
  81. #define WACOM_TRACE(...) WacomTrace(__VA_ARGS__)
  82. #else
  83. #define WACOM_TRACE(...)
  84. #define WACOM_ASSERT( x )
  85. #endif // WACOM_DEBUG