Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== Version 3 Technical Highlights - Mouse_Subs===== ^Published By^Date^Version^Knowledge Level^Keywords^ |Sprezzatura Ltd|01 OCT 1992|3.0+|EXPERT|MOUSE_SUBS| The Mouse_Subs routine has been fundamentally rewritten (to conform very closely to the published specifications for the Microsoft mouse driver - based around interrupt 33 calls) since it was discussed in Volume 3 Issue 7. It now only takes 4 parameters. As previously the first one is an action code but again, as this is a C or assembler routine the other parameters vary based upon the action code. ^Code^Description^Param1^Param2^Param3^ |0|Initialize mouse driver. Code returns 0 if a mouse is not installed or -1 if a mouse is installed and reset.\\ \\ If the mouse has been lost (due to PCing to DOS or somesuch) it can be restored with a Ctrl-Break OR by calling Mouse_Subs passing it a 0 followed by a 1|Must be null. Returns the number of buttons which is always 2 or Microsoft Mouse|Must be null|Must be null| |1|Turns mouse back on after it has been turned off with a code 2|Must be null|Must be null|Must be null| |2|Turns mouse off temporarily|Must be null|Must be null|Must be null| |3|Returns current location and state of mouse|Must be initialised. Returns\\ \\ 0 No key being pressed\\ 1 Left key being pressed\\ 2 Right key being pressed\\ 3 Left and right keys being pressed|Must be initialised. Returns the X position of the mouse|Must be initialised. Returns the Y position of the mouse| |4|Locates mouse at a given X, Y position on screen|Must be null|X position|Y position| |5\\ 6|Returns current location and button press state of mouse|Must be initialised. Returns\\ \\ 0 Key released\\ 1 Left key being held down\\ 2 Right key being held down\\ 3 Left and right keys being held down|Must be initialised.|Must be initialised.| |7|Sets the X coordinates within which the mouse can operate|Must be null|Leftmost X position or rightmost X position|Rightmost X position or leftmost X position| |8|Sets the Y coordinates within which the mouse can operate|Must be null|Leftmost Y position or rightmost Y position|Rightmost Y position or leftmost Y position| |10|Permits the definition of the mouse cursor character and the cursor colour. At the time of going to press the actual values have not been fully understood as it only seems to be used in PAINT when several items are selected by "boxing".|Initialise to zero|Set to 32512 if using the third parameter to specify the character to use for the cursor.\\ \\ Set to 30719 to reset the block cursor.³ Set to the ascii value to use for the mouse cursor, E.G. 2 for a smiley face, 65 for the letter A etc.\\ \\ Set to 30464 to reset the block cursor.| |11|Returns a location relative to the last time the mouse was queried. Whilst this information is not stunningly useful on its own it does provide a good way of finding out whether the mouse is moving. If the second parameter returns 0 then the mouse is still, any other value means that the mouse is moving|Must be null|Must be initialised. Returns the position of the mouse relative to where it last was as a positive or negative integer.|Must be null| |15|Sets the mickey to pixel ratio, that is, how far the mouse must move before the mouse cursor moves accordingly. The lower the value in Param2 and Param3 the more sensitive the mouse is|Must be null|The horizontal sensitivity of the mouse. The lower the number, the more the mouse cursor moves for a given mouse movement. Experiment with values between 1 and 20.|The vertical sensitivity of the mouse. The lower the number, the more the mouse cursor moves for a given mouse movement. Experiment with values between 1 and 20.| |21|Gets buffer size in bytes required by mouse|Returns buffer size.|Must be null|Must be null| |26|Sets mouse sensitivity. The lower the value used the less sensitive the mouse is. The range appears to be 1 to 100.|X value. Defaults to 50.|Y value. Defaults to 50.|Threshold for double speed. Defaults to 50.| |27|Queries mouse sensitivity|X value.|Y value.|Threshold for double speed.| |36|Queries the version number and the type of the mouse|Must be initialised to null. Returns the version number as what appears to be a decimal string that needs to be converted to a hex string. My mouse version is 7.04, the number returned for this is 1796, which if printed "MXyMD2" gives 7.04|Must be initialised to null. Returns the type of mouse multiplied by 256. Thus to get the mouse type divide by 256 and use the figures below taken from the SYSINCLUDE record CONFIGURE.RECORD.EQUS\\ \\ 1 Bus\\ 2 Serial\\ 3 InPort\\ 4 PS/2\\ 5 HP|Must be initialised to null.| Some calls have been omitted from the table above, specifically those which have little practical use for normal AREV programming. Note that several of the calls documented above are not currently used by AREV and thus may not be future proof. (It is considered that if AREV itself uses undocumented routines they are far more likely to stay there!). For further information about the missing calls see the Microsoft Mouse Programmer's Reference. Codes 7 and 8 are used to construct a box on the screen within which the mouse may move. Normally this would be set to the screen width and depth but there might be times when mouse movement within an area is desirable. The code 10 can be used to good effect within a loop in a program when you wish to indicate to a user that the mouse is inactive and that input from it will be ignored. The mouse cursor can be changed to another figure, or even as in the following example changed within the loop to give the illusion of a turning bar. <code> /* Following code for demonstration purposes only, change the delay loop to suit your own computer */ For z = 1 to 100 CALL MOUSE_SUBS( 10, 0, 32512, 47 ) ; * "/" for x = 1 to 1000 ; next CALL MOUSE_SUBS( 10, 0, 32512, 196 ) ; * "-" for x = 1 to 1000 ; next CALL MOUSE_SUBS( 10, 0, 32512, 92 ) ; * "\" for x = 1 to 1000 ; next CALL MOUSE_SUBS( 10, 0, 32512, 124 ) ; * "|" for x = 1 to 1000 ; next next CALL MOUSE_SUBS( 10, 0, 30719, 30464 ) </code> (Volume 4, Issue 5, Pages 4-7) tips/revmedia/v4i5a1.txt Last modified: 2024/06/19 20:20by 127.0.0.1