Mouse handling in C language :
NOTE: As tested On: Turbo C++,Version 3.0 by Borland International,Inc.
Mouse Programming : Introduction :
- Mouse is an input device or pointing device which functions by detecting two-dimensional motion relative to its supporting surface.
- In Graphics User Interface(GUI) system, mouse plays an important role for user interaction. It is very essential key factor in GUI.
- Today, mouse programming is mostly used in games development, animation programming and to build graphical applications like graphs, charts, tables etc.
- In computer system, each device has an unique port which has hexadecimal value.
- It has designed to be machine independent enhancing portability program.
- We can easily access ports in a C program.
- Basically, mouse uses 'interrupts' to access drivers.
- Mouse interrupt is handled using int86 function of dos.h header file.
- Mouse has port 0X33 attached to it and keyboard has attached to port 0X60.
- We can also use address registers.
- These is UNION of type REGS which is defined in "dos.h" header file.
- We can use two registers to communicate to a device driver as one for input and other for output.
- We can send value to device driver through the input register and receive information in it embedded in output register.
AX Register :
- AX=0 --- Returns mouse status
- AX=1 --- Show mouse pointer.
- AX=2 --- Hide mouse pointer.
- AX=3 --- Position of mouse. (X Coordinate:CX, Y Coordinate:DX)
- AX=3 --- Mouse button press
( If BX=0 then no any key is pressed,
If BX=1 then left button is pressed,
If BX=2 then right button is pressed,
If BX=3 then centre button is pressed. )
for mouse programing in c
CLICK ON
If BX=1 then left button is pressed,
If BX=2 then right button is pressed,
If BX=3 then centre button is pressed. )
for mouse programing in c
CLICK ON
No comments:
Post a Comment