1 {******************************************************************************} 2 { } 3 { Intellimouse API interface Unit for Object Pascal } 4 { } 5 { Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft } 6 { Corporation. All Rights Reserved. } 7 { } 8 { The original file is: zmouse.h, released June 2000. The original Pascal } 9 { code is: ZMOUSE.pas, released December 2000. The initial developer of the } 10 { Pascal code is Marcel van Brakel (brakelm att chello dott nl). } 11 { } 12 { Portions created by Marcel van Brakel are Copyright (C) 1999-2001 } 13 { Marcel van Brakel. All Rights Reserved. } 14 { } 15 { Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI) } 16 { } 17 { You may retrieve the latest version of this file at the Project JEDI } 18 { APILIB home page, located at http://jedi-apilib.sourceforge.net } 19 { } 20 { The contents of this file are used with permission, subject to the Mozilla } 21 { Public License Version 1.1 (the "License"); you may not use this file except } 22 { in compliance with the License. You may obtain a copy of the License at } 23 { http://www.mozilla.org/MPL/MPL-1.1.html } 24 { } 25 { Software distributed under the License is distributed on an "AS IS" basis, } 26 { WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for } 27 { the specific language governing rights and limitations under the License. } 28 { } 29 { Alternatively, the contents of this file may be used under the terms of the } 30 { GNU Lesser General Public License (the "LGPL License"), in which case the } 31 { provisions of the LGPL License are applicable instead of those above. } 32 { If you wish to allow use of your version of this file only under the terms } 33 { of the LGPL License and not to allow others to use your version of this file } 34 { under the MPL, indicate your decision by deleting the provisions above and } 35 { replace them with the notice and other provisions required by the LGPL } 36 { License. If you do not delete the provisions above, a recipient may use } 37 { your version of this file under either the MPL or the LGPL License. } 38 { } 39 { For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html } 40 { } 41 {******************************************************************************} 42 43 // $Id: JwaZMOUSE.pas,v 1.8 2007/09/14 06:48:49 marquardt Exp $ 44 45 {$IFNDEF JWA_OMIT_SECTIONS} 46 unit JwaZMOUSE; 47 48 {$I jediapilib.inc} 49 50 interface 51 52 uses 53 JwaWinUser, JwaWinType; 54 {$ENDIF JWA_OMIT_SECTIONS} 55 56 {$IFNDEF JWA_IMPLEMENTATIONSECTION} 57 {**************************************************************************** 58 * * 59 * ZMOUSE.H -- Include file for IntelliMouse(tm) 1.0 * 60 * * 61 * NOTE: Zmouse.h contains #defines required when providing IntelliMouse * 62 * wheel support for Windows95 and NT3.51. Wheel is supported * 63 * natively in WinNT4.0, please refer to the NT4.0 SDK for more info * 64 * on providing support for IntelliMouse in NT4.0. * 65 * * 66 * Copyright (c) 1983-1996, Microsoft Corp. All rights reserved. * 67 * * 68 \***************************************************************************} 69 70 {************************************************************************** 71 Client Application (API) Defines for Wheel rolling 72 ***************************************************************************} 73 74 // Apps need to call RegisterWindowMessage using the #define below to 75 // get the message number that is sent to the foreground window 76 // when a wheel roll occurs 77 78 const 79 {$IFDEF UNICODE} 80 MSH_MOUSEWHEEL = WideString('MSWHEEL_ROLLMSG'); 81 {$EXTERNALSYM MSH_MOUSEWHEEL} 82 {$ELSE} 83 MSH_MOUSEWHEEL = 'MSWHEEL_ROLLMSG'; 84 {$EXTERNALSYM MSH_MOUSEWHEEL} 85 {$ENDIF UNICODE} 86 87 // wParam = wheel rotation expressed in multiples of WHEEL_DELTA 88 // lParam is the mouse coordinates 89 90 {$IFNDEF JWA_INCLUDEMODE} 91 WHEEL_DELTA = 120; // Default value for rolling one notch 92 {$EXTERNALSYM WHEEL_DELTA} 93 94 WM_MOUSEWHEEL = WM_MOUSELAST + 1; // message that will be supported by the OS 95 {$EXTERNALSYM WM_MOUSEWHEEL} 96 {$ENDIF JWA_INCLUDEMODE} 97 98 {************************************************************************** 99 Client Application (API) Defines for 100 * determining if wheel support active 101 * determining # of Scroll Lines 102 ***************************************************************************} 103 104 // Class name for MSWHEEL.EXE's invisible window 105 // use FindWindow to get hwnd to MSWHEEL 106 107 {$IFDEF UNICODE} 108 MOUSEZ_CLASSNAME = WideString('MouseZ'); // wheel window class 109 {$EXTERNALSYM MOUSEZ_CLASSNAME} 110 MOUSEZ_TITLE = WideString('Magellan MSWHEEL'); // wheel window title 111 {$EXTERNALSYM MOUSEZ_TITLE} 112 {$ELSE} 113 MOUSEZ_CLASSNAME = 'MouseZ'; // wheel window class 114 {$EXTERNALSYM MOUSEZ_CLASSNAME} 115 MOUSEZ_TITLE = 'Magellan MSWHEEL'; // wheel window title 116 {$EXTERNALSYM MOUSEZ_TITLE} 117 {$ENDIF UNICODE} 118 119 MSH_WHEELMODULE_CLASS = MOUSEZ_CLASSNAME; 120 {$EXTERNALSYM MSH_WHEELMODULE_CLASS} 121 MSH_WHEELMODULE_TITLE = MOUSEZ_TITLE; 122 {$EXTERNALSYM MSH_WHEELMODULE_TITLE} 123 124 // Apps need to call RegisterWindowMessage using the #defines 125 // below to get the message numbers for: 126 // 1) the message that can be sent to the MSWHEEL window to 127 // query if wheel support is active (MSH_WHEELSUPPORT)> 128 // 2) the message to query for the number of scroll lines 129 // (MSH_SCROLL_LINES) 130 // 131 // To send a message to MSWheel window, use FindWindow with the #defines 132 // for CLASS and TITLE above. If FindWindow fails to find the MSWHEEL 133 // window or the return from SendMessage is false, then Wheel support 134 // is not currently available. 135 136 {$IFDEF UNICODE} 137 MSH_WHEELSUPPORT = WideString('MSH_WHEELSUPPORT_MSG'); // name of msg to send to query for wheel support 138 {$EXTERNALSYM MSH_WHEELSUPPORT} 139 {$ELSE} 140 MSH_WHEELSUPPORT = 'MSH_WHEELSUPPORT_MSG'; // name of msg to send to query for wheel support 141 {$EXTERNALSYM MSH_WHEELSUPPORT} 142 {$ENDIF UNICODE} 143 144 // MSH_WHEELSUPPORT 145 // wParam - not used 146 // lParam - not used 147 // returns BOOL - TRUE if wheel support is active, FALSE otherwise 148 149 {$IFDEF UNICODE} 150 MSH_SCROLL_LINES = WideString('MSH_SCROLL_LINES_MSG'); 151 {$EXTERNALSYM MSH_SCROLL_LINES} 152 {$ELSE} 153 MSH_SCROLL_LINES = 'MSH_SCROLL_LINES_MSG'; 154 {$EXTERNALSYM MSH_SCROLL_LINES} 155 {$ENDIF UNICODE} 156 157 {$IFNDEF JWA_INCLUDEMODE} 158 159 // MSH_SCROLL_LINES 160 // wParam - not used 161 // lParam - not used 162 // returns int - number of lines to scroll on a wheel roll 163 164 WHEEL_PAGESCROLL = UINT_MAX; // signifies to scroll a page, also 165 // defined in winuser.h in the NT4.0 SDK 166 {$EXTERNALSYM WHEEL_PAGESCROLL} 167 168 SPI_SETWHEELSCROLLLINES = 105; // Also defined in winuser.h in the 169 // NT4.0 SDK, please see the NT4.0 SDK 170 // documentation for NT4.0 implementation 171 // specifics. 172 // For Win95 and WinNT3.51, 173 // Mswheel broadcasts the message 174 // WM_SETTINGCHANGE (equivalent to 175 // WM_WININICHANGE) when the scroll 176 // lines has changed. Applications 177 // will recieve the WM_SETTINGCHANGE 178 // message with the wParam set to 179 // SPI_SETWHEELSCROLLLINES. When 180 // this message is recieved the application 181 // should query Mswheel for the new 182 // setting. 183 {$EXTERNALSYM SPI_SETWHEELSCROLLLINES} 184 {$ENDIF JWA_INCLUDEMODE} 185 186 {********************************************************************* 187 * INLINE FUNCTION: HwndMsWheel 188 * Purpose : Get a reference to MSWheel Window, the registered messages, 189 * wheel support active setting, and number of scrollLines 190 * Params : PUINT puiMsh_MsgMouseWheel - address of UINT to contain returned registered wheel message 191 * PUINT puiMsh_Msg3DSupport - address of UINT to contain wheel support registered message 192 * PUINT puiMsh_MsgScrollLines - address of UINT to contain Scroll lines registered message 193 * PBOOL pf3DSupport - address of BOOL to contain returned flag for wheel support active 194 * PINT piScrollLines - address of int to contain returned scroll lines 195 * Returns : HWND handle to the MsWheel window 196 * Note : The return value for pf3DSupport and piScrollLines is dependant 197 * on the POINT32 module. If POINT32 module is not running then 198 * the values returned for these parameters will be 199 * FALSE and 3, respectively. 200 *********************************************************************} 201 202 function HwndMSWheel(var puiMsh_MsgMouseWheel, puiMsh_Msg3DSupport, 203 puiMsh_MsgScrollLines: UINT; var pf3DSupport: BOOL; 204 var piScrollLines: Integer): HWND; 205 {$EXTERNALSYM HwndMSWheel} 206 207 {$ENDIF JWA_IMPLEMENTATIONSECTION} 208 209 {$IFNDEF JWA_OMIT_SECTIONS} 210 implementation 211 //uses ... 212 {$ENDIF JWA_OMIT_SECTIONS} 213 214 {$IFNDEF JWA_INTERFACESECTION} 215 function HwndMSWheel(var puiMsh_MsgMouseWheel, puiMsh_Msg3DSupport, 216 puiMsh_MsgScrollLines: UINT; var pf3DSupport: BOOL; 217 var piScrollLines: Integer): HWND; 218 begin 219 Result := FindWindow(MSH_WHEELMODULE_CLASS, MSH_WHEELMODULE_TITLE); 220 puiMsh_MsgMouseWheel := RegisterWindowMessage(MSH_MOUSEWHEEL); 221 puiMsh_Msg3DSupport := RegisterWindowMessage(MSH_WHEELSUPPORT); 222 puiMsh_MsgScrollLines := RegisterWindowMessage(MSH_SCROLL_LINES); 223 if (puiMsh_Msg3DSupport <> 0) and (Result <> 0) then 224 pf3DSupport := BOOL(SendMessage(Result, puiMsh_Msg3DSupport, 0, 0)) 225 else 226 pf3DSupport := False; // default to FALSE 227 if (puiMsh_MsgScrollLines <> 0) and (Result <> 0) then 228 piScrollLines := SendMessage(Result, puiMsh_MsgScrollLines, 0, 0) 229 else 230 piScrollLines := 3; // default 231 end; 232 233 {$ENDIF JWA_INTERFACESECTION} 234 235 {$IFNDEF JWA_OMIT_SECTIONS} 236 end. 237 {$ENDIF JWA_OMIT_SECTIONS} 238 239