Dec 142017
 
TP 5.0+ Mouse Routines for Microsoft and Logitech mice.
File KMOUSE10.ZIP from The Programmer’s Corner in
Category Pascal Source Code
TP 5.0+ Mouse Routines for Microsoft and Logitech mice.
File Name File Size Zip Size Zip Type
KEYMOUS.ASM 7623 2467 deflated
KEYMOUS.OBJ 822 599 deflated
KMOUSE.PAS 10516 2853 deflated
READ.ME 6167 1976 deflated
TESTKMOU.PAS 2121 893 deflated

Download File KMOUSE10.ZIP Here

Contents of the READ.ME file


KMOUSE


KMouse is a Turbo Pascal Micorsoft/Logitech Mouse handler
that enables text based programs to use a mouse with a minimal
amount of effort by the programmer. Simply add Kmouse to
your USES statement and your program is 'Mouseified.'

In a nutshell, KMOUSE offers the following features:

o Inserts mouse movement and button press keys directly
into the keyboard buffer.
o Programmable Key simulation for each button.
o Programmable delays for vertical and horizontal mouse
movements. Makes menus feel more natural.
o The mouse event handler is programmed in assembler for
fastest possible execution speed.
o The mouse entry state is restored upon exit if the mouse
driver (Mouse.Sys, or Mouse.Com) is Version 6.0 or greater.
o Designed to quickly interface with existing text based
applications.
o Compatible with Turbo Pascal Versions 4.0 to (as of the
present) 5.5.

Files included:
KMouse.PAS - Unit driver for the mouse.
TestKmou.PAS - Demo program.
Keymous.ASM - Assembley language mouse event handler.
KeyMous.OBJ - Object file linkable to KMouse.
Read.ME - This file.

The Mouse Interface:
{ Exposed to the programmer Using this Unit }

InterFace

Const
HasMouse : Boolean = False;
{ Set to True if mouse found during initialization }
MouseVerified : Boolean = False;
{ Set to True if the mouse reset function finds the mouse }
GoodMouse : Boolean = False;
{ Set to True if Mouse driver is Ver. 6 or higher }

{Mouse Motion Masks}
MoveRight = $01;
MoveLeft = $02;
MoveDown = $04;
MoveUp = $08;
MoveAll = $0F;
{ The default is MoveAll }

{Mouse Report masks}
MouseMoved = $01;
MouseLBPressed = $02;
MouseLBReleased = $04;
MouseRBPressed = $08;
MouseRBReleased = $10;
MouseMBPressed = $20;
MouseMBReleased = $40;
{ The default is MouseMoved }


Procedure ResetMouse;
{Performs hardware reset on the mouse, sets Mouse verified}

Procedure InitMouse(Mask:Word);

{ InitMouse installs the mouse handler to the mouse. It must be called }
{ during program initialization, although additional calls are harmless }
{ and may be used to change the interrupt mask. }
{ Mask is the mask passed to the mouse driver to define the Mouse }
{ actions to report on. This Word is bit encoded as follows: }
{ }
{ 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 }
{ 0 0 0 0 0 0 0 0 0 x x x x x x x }
{ ------------------------- ^ ^ ^ ^ ^ ^ ^ }
{ ^ | | | | | | Mouse motion }
{ | | | | | | Left button pressed }
{ | | | | | Left button released }
{ | | | | Right button pressed }
{ | | | Right button released }
{ | | Mid Button pressed }
{ | Mid button released }
{ Reserved, must be 0 }
{ If the bit is set (ie, 1) the mouse calls the user installed handler }
{ when the event occurs. }
{ Utilizing the constants above for the Mask, the call }
{ InitMouse(MouseMoved+MouseLBReleased+MouseRBReleased); }
{ installs the handler and sets the mouse for motion, and L & R button }
{ releases. }


Procedure SetMouseMotion(Direction : Byte);
{ Sets the movement directions the mouse will report on. }
{ Using the the definitions of the constants above, following the call }
{ SetMouseMotion(MoveUp+MoveDown), the mouse will report vertical motion}
{ Correspondingly, SetMouseMotion(MoveAll); establishes vertical and }
{ horizontal mouse motion. The default is MoveAll. Use this procedure }
{ to toggle mouse response from a vertical to a horizonal menu or a }
{ full screen application. }

Procedure SetMouseButtons( LB,RB,MB : Word );
{ Causes the mouse buttons to return the specified scancodes. }
{ Should be called before first initialization, may be called anytime }
{ after to change the buttons returned scancodes. Each button enabled }
{ by the call mask must be > 0 }

Procedure SetMouseDelay( VDelay, HDelay : Word);
{ Sets the delay count for vertical and horizontal mouse movements. The }
{ delay is read and decremented by the mouse driver and only actuated }
{ when the delay counter reaches 0. Use this Procedure to change the }
{ mouse sensitivity for menus, etc. The default is VDelay = 3, HDelay =1}

Procedure SaveMouse;
{ Saves the mouse state if the mouse driver is ver. 6.0 or higher. }

Procedure RestoreMouse;
{ Restores a previously saved mouse state if the mouse driver is Ver. 6.0 }
{ or higher. }

{ The initialization code saves the current mouse in a separate buffer and }
{ restores it during the exit process. }
{ The save/restore mouse procs may be used by a TP application before and }
{ after spawning a child process, eg. in a menuing program. }
{ These procedures require that GoodMouse be true, ie. the mouse driver }
{ must be ver 6.0 or higher. }

(*****************************************************************************)


 December 14, 2017  Add comments

Leave a Reply