home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 11 Util
/
11-Util.zip
/
MOUSCALE.ZIP
/
MOUSCALE.C
next >
Wrap
Text File
|
1991-04-29
|
3KB
|
112 lines
/* Written 3/25/91 by Joel Apisdorf
*
* (703) 437-1837
* Reston, Virginia
*
* You are free to use and modify it as you like.
*/
/* Usage: MOUSCALE X Y
*
* Where: X and Y are scale factors for mouse
* in X and Y directions, respectively.
*
* The larger the value, the slower
* the mouse moves in that direction.
*
* I typically use MOUSCALE 5 5 with my 200 dpi Microspeed trackball
* and the MSSER01.SYS mouse device driver set up for MODEL=199.
*
* This program only affects the PM graphics mouse movement,
* NOT the full-screen mouse movement, such as you have
* in the CodeView debugger.
*/
#define INCL_DOSFILEMGR
#define INCL_DOSDEVICES
#include <os2.h>
#include <stdio.h>
#include <stdlib.h>
CHAR szMouse[] = "MOUSE$";
void main( int argc, char *argv[] )
{
HFILE hfMouse;
USHORT usResult;
USHORT usAction;
USHORT usFileAttributes = FILE_NORMAL;
USHORT usOpenFlags = OPEN_ACTION_OPEN_IF_EXISTS
| OPEN_ACTION_FAIL_IF_NEW;
USHORT usOpenMode = OPEN_ACCESS_READWRITE
| OPEN_SHARE_DENYNONE
| OPEN_FLAGS_NOINHERIT
| OPEN_FLAGS_NO_LOCALITY
| OPEN_FLAGS_FAIL_ON_ERROR;
USHORT usFunction;
PVOID pData, pParm;
BOOL fArgsGood = FALSE;
struct {
SHORT y, x;
} MouseScaling;
/* If there are 2 and only 2 arguments...
*/
if( argc == 3 )
{
/* Convert the scale factors to numbers.
*
* These are in units of mickeys per pixel.
*/
MouseScaling.x = atoi( argv[ 1 ] );
MouseScaling.y = atoi( argv[ 2 ] );
/* If the scale factors are both
* between 1 and 32767...
*/
if( MouseScaling.x > 0 && MouseScaling.y > 0 )
/* The arguments are valid.
*/
fArgsGood = TRUE;
}
if( !fArgsGood )
return;
/* Open the mouse device.
*/
usResult = DosOpen( szMouse, &hfMouse,
&usAction, 0L,
usFileAttributes,
usOpenFlags,
usOpenMode,
0L
);
if( usResult )
return;
/* Set the mouse scaling factors.
*/
usResult = DosDevIOCtl( NULL, &MouseScaling, 0x53, 7, hfMouse );
/* Close the mouse device.
*/
DosClose( hfMouse );
}