Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

168 lines
7.1 KiB

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