UTILS\MOUSEMAN.DOC  ·  DOC  ·  12.7 KB  ·  1988-11-04  ·  from PCPlus_Issue-36_Sep_1989-FluxEngine-360kB
                                      MM
                                     ~~~~
                Mouse Manager (c) Colin J Smith November 1988


                                  Files on disk
                                ~~~~~~~~~~~~~~~
                MM.EXE  ; the program to manage the mouse
                MM.C    ; 'C' source code
                MM.DOC  ; this file
             MTEST.BAT  ; batch file to test operation of MM.EXE


	MM   was  written  in  the 'C' language.   The  'C'   source   is
	included and should compile in 'Borland Turbo C', 'Microsoft  C',
	or 'Zortech C++'.


	MM will be useful when you wish to quickly and easily temporarily
	override  the  NVR mouse settings.  When used in batch  files  MM
	will allow you to flexibly manage your mouse and prevent you from
	pulling out your dusty copy of NVR too often.


	It  is  designed to work with batch files  interfaced  using  the
	ERRORLEVEL.   Users can create their own customised  batch  files
	which will  allow them  set certain mouse  characteristics before
	running a program that will use the mouse.


	To look at the list of options available issue the command:-

	          MM <RETURN>    ; this will display the usage


	To set an option use:-

        	  MM o n ..      ; where 'o' is the option and 'n..'
                	         ; are the arguments which a particular
                        	 ; option may require



                                 Using MTEST.BAT
                                ~~~~~~~~~~~~~~~~~

	MTEST.BAT is a batch file program which shows the typical
	applications for which MM can be used.

	To run MTEST use:-

          	MTEST <Return>


	MTEST may be slow  depending on the area of the floppy disk it is
	positioned  because  it needs to  access MM.EXE  a few times.  In
	your  own  programs  you may  only access  MM.EXE a few times  so
	this  should not be a problem.  If your batch files  will  access
	MM.EXE  a  great  deal then you  should  either  put  MM.EXE onto
	a 'ramdisk' or your hard disk to offer best efficiency.


	MM is ideal to  insert in your  AUTOEXEC.BAT file so that you can
	for instance set the mouse movement so it is ready after booting.


                           Using the ERRORLEVEL value
                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

	MM returns an ERRORLEVEL value depending on the option chosen which
	can be used by batch files:-

	batch file extract,

MM 1                         	; batch file runs MM to reset mouse
IF ERRORLEVEL==255 GOTO NOMOUSE	; no mouse
IF ERRORLEVEL==3 GOTO 3BUT      ; mouse has 3 buttons
IF ERRORLEVEL==2 GOTO 2BUT      ; mouse has 2 buttons
IF ERRORLEVEL==1 GOTO 1BUT   	; if the ERRORLEVEL return value was 1
				; then it means a mouse was installed and
				; it had 1 mouse button


	The method of checking the mouse is to run MM and then using
	ERRORLEVEL to determine the result and acting accordingly.

	You don't have any excuse for writing those batch files now!,

	Enjoy!


	                     T H E   O P T I O N S
                            ~~~~~~~~~~~~~~~~~~~~~~~

	1  Check and reset mouse
	------------------------

	This option checks the mouse driver to see if it is present.   If
	the  driver is present then the mouse settings are reset and  the
	number of buttons on the mouse is returned.

--ERRORLEVEL returns

255 - no mouse driver
  1 - mouse is installed, has 1 button
  2 - mouse is installed, has 2 buttons
  3 - mouse is installed, has 3 buttons


	2  Set mouse cursor status
	--------------------------

	This option allows you to turn the mouse cursor either on or off.
	eg.
        	  MM 2 1    ; turns cursor ON (show)

	          MM 2 0    ; turns cursor OFF (hide)

	This option is cumulative ie if you call the 'show' option  twice
	in succession then it will require two calls of the 'hide' option
	to turn the mouse cursor off again.


	3  Set light pen emulation status
	---------------------------------

	This is a nice option which allows the mouse to act like a  light
	pen and so maintain a degree of compatibility with software which
	uses  or expects a light pens for input.  When using this  option
	you must specify whether you require emulation to be ON or OFF.
	eg.
        	  MM 3 1    ; turns light pen emulation ON

	          MM 3 0    ; turns light pen emulation OFF

	If you turn emulation on then:-

          	  simulate PEN DOWN by
     		  --------------------
     		  pressing <LEFT> and <RIGHT> mouse buttons together

		  simulate PEN UP by
     		  ------------------
     		  releasing all buttons


	4  Get button status
	--------------------

	This option checks a specified mouse button to see if it is being
	pressed.   You specify the mouse button to check, either  <LEFT>,
	<RIGHT>  or <CENTRE>.  The buttons are identified as  1-Left,  2-
	Right  and  3-Centre.   An errorlevel  is  returned  telling  you
	whether the button was pressed or not.
	eg.
        	  MM 4 1    ; looks at status of <LEFT> mouse button

        	  MM 4 2    ; looks at status of <RIGHT> mouse button

	          MM 4 3    ; looks at status of <CENTRE> mouse button

--ERRORLEVEL returns

0 - button NOT depressed
1 - button depressed


	5  Wait for button
	------------------

	This  option is similar to option 4 - get button  status,  except
	for  the  fact that this option waits until the  specified  mouse
	button  is pressed.  You specify the button you wish to wait  for
	1-Left, 2-Right or 3-Centre.
	eg.
        	  MM 5 1    ; waits until <LEFT> button is pressed

	          MM 5 2    ; waits until <RIGHT> button is pressed

	          MM 5 3    ; waits until <CENTRE> button is pressed

	You should be careful if you are using this option on two  button
	mice, such as the one supplied with the Amstrad computers.   They
	have only <LEFT> and <RIGHT> mouse buttons, so it is not possible
	for you to wait for the <CENTRE> button to be pressed because  it
	doesn't exist - therefore you will crash the system.


	6  Set acceleration speed threshold
	-----------------------------------

	The  acceleration speed threshold is measured in  mickeys/second.
	When  moving  the  mouse cursor around the screen  the  speed  of
	acceleration is detected.  You can use this option to change  the
	threshold  level which if exceeded means a  coarser  mickey/pixel
	ratio is used.
	eg.
        	  MM 6 100 ; sets the acceleration threshold ratio

	Low values give a jerkier/faster response eg 1.
	Large values give a slower/slugish response eg 10000.


	7  Set hardware cursor scanline
	-------------------------------

	This option allows the shape of the text mode mouse cursor to  be
	changed.   You  must specify the start and finish of  the  cursor
	scanlines.  These will be different for different screen modes ie
	colour - 0 7,  monochrome - 0 14, will set a block shape cursor.
	eg.
        	  MM 7 0 7  ; sets block cursor on colour CGA monitor

	          MM 7 0 14 ; sets block cursor on monochrome monitor


	8  Set X & Y motion/pixel ratio
	-------------------------------

	This  option  allows you to change the scaled movement  over  the
	screen  ie the motion to pixel ratio (how much the cursor on  the
	screen moves in relation to the physical movement of the  mouse).
	This  ratio is measured in 'mickeys' - the number of  pixels  per
	inch.   Quality  mice usually have a mickey ratio  of  200  which
	means  they have a greater degree of accuracy and  response  over
	mice with say a 100 mickey ratio.
	eg.
        	  MM 8 50 100  	; sets X to 50 mickeys/Y to 100 mickeys

	The value of the Y ratio is twice that of the X ratio to maintain
	uniform movement ie X ratio = 1:1, Y ratio = 2:1.

	Low values  such as 1 give quick  large movement movement  on the
	screen to small movement of the mouse.
	Large  values such as 100 give small movement on  screen to large
	movement of the mouse.


	9  Set New Min & Max X position
	-------------------------------

	This option allows you to set the minimum and maximum  horizontal
	movement boundary.  The default are:-

	          min X = 0      max X = 639

        measured in terms of pixel positions.


        pixel position 0   7  15  23  31                          631 639
                column 0   1   2   3   4...........................78  79
	                       ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
                               ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
			       ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
			       ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
			       ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
                               ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
                               ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
                               ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
                               ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
                               ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓X▓REGION▓▓▓▓▓▓▓▓▓▓▓▓▓▓
                               ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
                               ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
                               ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
                               ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
                               ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
                               ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
                               ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
                               ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
                             MinX                                  MaxX

	The  positions are in terms of pixel positions, so when  in  text
	mode  you calculate the pixel positions by multiplying  the  text
	column by 8 and subtracting 1.
	eg.

	To  set  the minimum X position to start at column  10  and  then
	finish at the maximum X position at column 70:-

		  min X =     10 * 8 - 1   =    79

                  max X =     70 * 8 - 1   =    559

	issue the command:-

	          MM 9 79 559    ; sets min X position to column 10 and
	                         ; max X position to column 70

        Where the X region and Y regions overlap is the possible region
	where you can move the mouse cursor.  Set the Y region with the
	option 10.
	eg.
		      MinX  MaxX
			|    |
			░░░░░░
                        ░░░░░░                                ___MinY
        ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
        ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
        ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
        ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
        ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒___MaxY
                        ░░░░░░
                        ░░░░░░
                        ░░░░░░
                        ░░░░░░


        ▓▓ = region where mouse cursor can be moved


	To reset the minimum and maximum positions the mouse can move
	on the screen use option 1 - reset mouse OR just supply some
	new values to option 9 and 10.
	eg.
		MM 9 0 639  	; set min/max to original

		MM 10 0 199	; set min/max to original


	10  Set New Min & Max Y position
	--------------------------------

	This  option allows you to set the minimum and  maximum  vertical
	movement boundary.  The default are:-

	          min Y = 0      max Y = 199

        pixel
	pos. col
          0   0                                                          MinY
	  7   1  ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
         15   2  ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
	      .  ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
	      .  ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓Y▓REGION▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
              .  ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
             23  ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
	     24  ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓MaxY
        199  25


	The  positions are in terms of pixel positions, so when  in  text
	mode  you calculate the pixel positions by multiplying  the  text
	column by 8 and subtracting 1.
	eg.

	To  set  the  minimum Y position to start at column  5  and  then
	finish at the maximum Y position at column 20:-

		  min Y =      5 * 8 - 1   =    39

		  max Y =     20 * 8 - 1   =    159

	issue the command:-

          	  MM 10 39 159   ; sets min Y position to column 5 and
                                 ; max Y position to column 20

	Usually this option would be used in conjuction with option 9 to
	set up a mouse movement 'window' which is where the X and Y regions
	overlap.

	-----------------------------------------------------------------