C Program to Hide Mouse Pointer : Dos Programming
C Program to Hide Mouse Pointer :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #include<graphics.h> #include<conio.h> #include<dos.h> void showmouseptr(); void hidemouseptr(); union REGS i, o; int main() { int count = 1, gDriver = DETECT, gMode; initgraph(&gDriver, &gMode, "C\\:tc\\bgi"); i.x.ax = 0; int86(0X33, &i, &o); if (o.x.ax == 0) { printf("ntMouse Support is Unavailable !!"); } else { showmouseptr(); while (count <= 10) { getch(); count++; if (count % 2 == 0) hidemouseptr(); else showmouseptr(); } } getch(); return 0; } void showmouseptr() { i.x.ax = 1; int86(0X33, &i, &o); } void hidemouseptr() { i.x.ax = 2; int86(0X33, &i, &o); } |
Explanation Of C Program :
Firstly let us study some important points about interrupts handeling.
1 2 | i.x.ax = 0; int86(0X33,&i,&o); |
will check whether the mouse driver exists or not.
input | output | Comment |
ax=0x0000 | ax=0x0000 or 0xFFFF bx=number of buttons | 0x0000 installed 0xFFFF not installed |
Int86() is a C function that allows to call interrupts in the program. prototype in dos.h
Int 33,0×01 : Show Mouse cursor
input | output | Comment |
ax=0x0001 | none |
Int 33,0×02 : Hide Mouse Cursor
input | output | Comment | ||||
|
|
In and out register must be type of REGS. REGS is a built in UNION declaration in C. It is defined in the dos.h header file
Syntax :
1 | int86 (int intr num, union REGS *inreg, union REGS *outreg); |