zmouse.h 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. /****************************************************************************
  2. * *
  3. * ZMOUSE.H -- Include file for IntelliMouse(tm) 1.0 *
  4. * *
  5. * NOTE: Zmouse.h contains #defines required when providing IntelliMouse *
  6. * wheel support for Windows95 and NT3.51. Wheel is supported *
  7. * natively in WinNT4.0, please refer to the NT4.0 SDK for more info *
  8. * on providing support for IntelliMouse in NT4.0. *
  9. * *
  10. * Copyright (c) 1983-1996, Microsoft Corp. All rights reserved. *
  11. * *
  12. \***************************************************************************/
  13. /**************************************************************************
  14. Client Appplication (API) Defines for Wheel rolling
  15. ***************************************************************************/
  16. // Apps need to call RegisterWindowMessage using the #define below to
  17. // get the message number that is sent to the foreground window
  18. // when a wheel roll occurs
  19. #ifdef UNICODE
  20. #define MSH_MOUSEWHEEL L"MSWHEEL_ROLLMSG"
  21. #else
  22. #define MSH_MOUSEWHEEL "MSWHEEL_ROLLMSG"
  23. #endif
  24. // wParam = wheel rotation expressed in multiples of WHEEL_DELTA
  25. // lParam is the mouse coordinates
  26. #define WHEEL_DELTA 120 // Default value for rolling one notch
  27. #ifndef WM_MOUSEWHEEL
  28. #define WM_MOUSEWHEEL (WM_MOUSELAST+1) // message that will be supported
  29. // by the OS
  30. #endif
  31. /**************************************************************************
  32. Client Appplication (API) Defines for
  33. * determining if wheel support active
  34. * determining # of Scroll Lines
  35. ***************************************************************************/
  36. // Class name for MSWHEEL.EXE's invisible window
  37. // use FindWindow to get hwnd to MSWHEEL
  38. #ifdef UNICODE
  39. #define MOUSEZ_CLASSNAME L"MouseZ" // wheel window class
  40. #define MOUSEZ_TITLE L"Magellan MSWHEEL" // wheel window title
  41. #else
  42. #define MOUSEZ_CLASSNAME "MouseZ" // wheel window class
  43. #define MOUSEZ_TITLE "Magellan MSWHEEL" // wheel window title
  44. #endif
  45. #define MSH_WHEELMODULE_CLASS (MOUSEZ_CLASSNAME)
  46. #define MSH_WHEELMODULE_TITLE (MOUSEZ_TITLE)
  47. // Apps need to call RegisterWindowMessage using the #defines
  48. // below to get the message numbers for:
  49. // 1) the message that can be sent to the MSWHEEL window to
  50. // query if wheel support is active (MSH_WHEELSUPPORT)>
  51. // 2) the message to query for the number of scroll lines
  52. // (MSH_SCROLL_LINES)
  53. //
  54. // To send a message to MSWheel window, use FindWindow with the #defines
  55. // for CLASS and TITLE above. If FindWindow fails to find the MSWHEEL
  56. // window or the return from SendMessage is false, then Wheel support
  57. // is not currently available.
  58. #ifdef UNICODE
  59. #define MSH_WHEELSUPPORT L"MSH_WHEELSUPPORT_MSG" // name of msg to send
  60. // to query for wheel support
  61. #else
  62. #define MSH_WHEELSUPPORT "MSH_WHEELSUPPORT_MSG" // name of msg to send
  63. // to query for wheel support
  64. #endif
  65. // MSH_WHEELSUPPORT
  66. // wParam - not used
  67. // lParam - not used
  68. // returns BOOL - TRUE if wheel support is active, FALSE otherwise
  69. #ifdef UNICODE
  70. #define MSH_SCROLL_LINES L"MSH_SCROLL_LINES_MSG"
  71. #else
  72. #define MSH_SCROLL_LINES "MSH_SCROLL_LINES_MSG"
  73. #endif
  74. // MSH_SCROLL_LINES
  75. // wParam - not used
  76. // lParam - not used
  77. // returns int - number of lines to scroll on a wheel roll
  78. #ifndef WHEEL_PAGESCROLL
  79. #define WHEEL_PAGESCROLL (UINT_MAX) // signifies to scroll a page, also
  80. // defined in winuser.h in the
  81. // NT4.0 SDK
  82. #endif
  83. #ifndef SPI_SETWHEELSCROLLLINES
  84. #define SPI_SETWHEELSCROLLLINES 105 // Also defined in winuser.h in the
  85. // NT4.0 SDK, please see the NT4.0 SDK
  86. // documentation for NT4.0 implementation
  87. // specifics.
  88. // For Win95 and WinNT3.51,
  89. // Mswheel broadcasts the message
  90. // WM_SETTINGCHANGE (equivalent to
  91. // WM_WININICHANGE) when the scroll
  92. // lines has changed. Applications
  93. // will recieve the WM_SETTINGCHANGE
  94. // message with the wParam set to
  95. // SPI_SETWHEELSCROLLLINES. When
  96. // this message is recieved the application
  97. // should query Mswheel for the new
  98. // setting.
  99. #endif
  100. /*********************************************************************
  101. * INLINE FUNCTION: HwndMsWheel
  102. * Purpose : Get a reference to MSWheel Window, the registered messages,
  103. * wheel support active setting, and number of scrollLines
  104. * Params : PUINT puiMsh_MsgMouseWheel - address of UINT to contain returned registered wheel message
  105. * PUINT puiMsh_Msg3DSupport - address of UINT to contain wheel support registered message
  106. * PUINT puiMsh_MsgScrollLines - address of UINT to contain Scroll lines registered message
  107. * PBOOL pf3DSupport - address of BOOL to contain returned flag for wheel support active
  108. * PINT piScrollLines - address of int to contain returned scroll lines
  109. * Returns : HWND handle to the MsWheel window
  110. * Note : The return value for pf3DSupport and piScrollLines is dependant
  111. * on the POINT32 module. If POINT32 module is not running then
  112. * the values returned for these parameters will be
  113. * FALSE and 3, respectively.
  114. *********************************************************************/
  115. __inline HWND HwndMSWheel(
  116. PUINT puiMsh_MsgMouseWheel,
  117. PUINT puiMsh_Msg3DSupport,
  118. PUINT puiMsh_MsgScrollLines,
  119. PBOOL pf3DSupport,
  120. PINT piScrollLines
  121. )
  122. {
  123. HWND hdlMsWheel;
  124. hdlMsWheel = FindWindow(MSH_WHEELMODULE_CLASS, MSH_WHEELMODULE_TITLE);
  125. *puiMsh_MsgMouseWheel = RegisterWindowMessage(MSH_MOUSEWHEEL);
  126. *puiMsh_Msg3DSupport = RegisterWindowMessage(MSH_WHEELSUPPORT);
  127. *puiMsh_MsgScrollLines = RegisterWindowMessage(MSH_SCROLL_LINES);
  128. if (*puiMsh_Msg3DSupport)
  129. *pf3DSupport = (BOOL)SendMessage(hdlMsWheel, *puiMsh_Msg3DSupport, 0, 0);
  130. else
  131. *pf3DSupport = FALSE; // default to FALSE
  132. if (*puiMsh_MsgScrollLines)
  133. *piScrollLines = (int)SendMessage(hdlMsWheel, *puiMsh_MsgScrollLines, 0, 0);
  134. else
  135. *piScrollLines = 3; // default
  136. return(hdlMsWheel);
  137. }