Emulate Mouse Driver for OS/2 (ArcaOS, eComStation)

This product is available free of charge and may be used at your own risk. Have fun. Click here for the ISC license.

Description - This driver enables you to send absolute mouse events into the system. It provides an application programming interface that conforms to the standard DosRead and DosWrite functions and as such may be easily used from rexx procedures using the charin and charout functions. It has been especially designed to ease the development and integration of touch screen solutions into the system.

Installation - Move the XSMOUSE10.ZIP file into a directory of your choice and unzip it. Copy the XSMOUSE.SYS device driver to your C:\OS2\BOOT directory. Look into your CONFIG.SYS file to determine which mouse device driver has been installed on your system. You may find AMOUSE.SYS or MOUSE.SYS and you need to add the STYPE=XSMOUSE$ parameter to that device driver statement and to insert the DEVICE=C:\OS2\BOOT\XSMOUSE.SYS device driver statement just above it. Restart your system. After that XSMOUSE$ will be the device driver name to be used.

Obtain this product here free of charge. Click here for source/samples. Click here for my home page.

Event Buffer

Common Event Buffer
fieldsizedescription
Eventwordmouse event flags
yPoswordcurrent y position
xPoswordcurrent x position
yMaxwordmaximum y position
xMaxwordmaximum x position

The common event buffer is used to send absolute mouse events to mouse.sys like this is usually done for touch screens. Positions are measured in absolute coordinates. The coordinate position 0,0 represent the top left corner of the screen and the coordinate position yMax,xMax represent the bottom right corner of the screen and these are mapped by mouse.sys into the current display mode.

Mouse Events

Old Position
button stateflag
all buttons up0000h
button 1 down0004h
button 2 down0010h
button 3 down0040h
New Position
button stateflag
all buttons up0001h
button 1 down0002h
button 2 down0008h
button 3 down0020h

To report button states when the mouse stays at the old coordinate position use the mouse event flags listed under Old Position. To report button states when the mouse moves to the new coordinate position use the mouse event flags listed under New Position.

Rexx Examples

getevent.cmd - Reads the last pointing device event from the common event buffer. Displays that event in hexadecimal format.

putevent.cmd - Moves the pointer to the center of the screen. Displays that absolute pointing device event in hexadecimal format.

Prototyping Interface

The prototyping interface uses OS/2 Procedures language 2/REXX functions. To emulate the mouse the following functions are described:

Acquire Driver

rc=stream(sName,'command','open');

Opens the device driver for read/write access with this process.

sName - Name of the device driver to be opened.

rc - Return Code. See the OS/2 Procedures Language 2/REXX Reference for the standard strings returned.

Read Mouse Event

sBuffer=charin(sName,,10);

Reads the last pointing device event from the common event buffer.

sName - Name of the device driver to be used.

sBuffer - Name of the buffer to receive the common event buffer content.

Write Mouse Event

rc=charout(sName,sBuffer);

Writes the absolute pointing device event into the common event buffer.

sName - Name of the device driver to be used.

sBuffer - Name of the buffer containing the absolute pointing device event.

rc - Return Code. See the OS/2 Procedures Language 2/REXX Reference for the standard strings returned.

Release Driver

rc=stream(sName,'command','close');

Closes the device driver for read/write access with this process.

sName - Name of the device driver to be closed.

rc - Return Code. See the OS/2 Procedures Language 2/REXX Reference for the standard strings returned.

Application Program Interface

The application program interface uses OS/2 Control Program functions. To emulate the mouse the following functions are described:

DosOpen

ulrc=DosOpen(pszName,phDevice,pulAction,0,0,1,18,0);

Opens the device driver for read/write access with this process.

pszName - Address of the asciiz name of the device driver to be opened.

phDevice - Address of the variable to receive the device handle.

pulAction - Address of the variable to receive the action taken.

ulrc - Return Code. See the Control Program Guide and Reference for the standard values returned.

DosRead

ulrc=DosRead(hDevice,pBuffer,10,pcbDone);

Reads the last pointing device event from the common event buffer.

hDevice - The device handle obtained from a previous call to DosOpen.

pBuffer - Address of the buffer to receive the common event buffer content.

pcbDone - Address of the variable to receive the number of bytes (10).

ulrc - Return Code. See the Control Program Guide and Reference for the standard values returned.

DosWrite

ulrc=DosWrite(hDevice,pBuffer,10,pcbDone);

Writes the absolute pointing device event into the common event buffer.

hDevice - The device handle obtained from a previous call to DosOpen.

pBuffer - Address of the buffer containing the absolute pointing device event.

pcbDone - Address of the variable to receive the number of bytes (10).

ulrc - Return Code. See the Control Program Guide and Reference for the standard values returned.

DosClose

ulrc=DosClose(hDevice);

Closes the device driver for read/write access with this process.

hDevice - The device handle obtained from a previous call to DosOpen.

ulrc - Return Code. See the Control Program Guide and Reference for the standard values returned.

Conforms to XHTML 1.0 Conforms to CSS 2.1 W.M.Brul 2010-2016, all rights reserved.