How to create the mouse pointers in c language. Different shapes can be given to the mouse pointer by changing the values of the cursor variable array.
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 45 46 47 48 49 50 51 52 53 54 55 56 | #include <stdio.h> #include <conio.h> #include <dos.h> #include <stdlib.h> #include <graphics.h> void showmouseptr(); int initmouse(); void changecursor(int *shape); union REGS i,o; struct SREGS s; int cursor[32]={ 0x0000, 0x0000, 0x0000, 0x0000, 0x8001, 0xc003, 0xf00f, 0xfc3f, 0xfcff, 0xfcff, 0xfcff, 0xfcff, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0x8001, 0xffff, 0x8001, 0x4002, 0x2004, 0x1008, 0x0240, 0x0240, 0x0810, 0x2004, 0x4002, 0x8001, 0xffff, 0x8001, 0xffff, }; void main () { int gd=DETECT,gm; initgraph(&gd,&gm,"e:\\tc\\bgi"); gotoxy(10,3); printf("HELLO"); changecursor(cursor); showmouseptr(); getch(); } int initmouse() { i.x.ax=0; int86(0x33,&i,&o); return(o.x.ax); } void showmouseptr() { i.x.ax=1; int86(0x33,&i,&o); } void changecursor(int *shape) { i.x.ax=9; i.x.bx=0; i.x.cx=0; i.x.dx=(unsigned)shape; segread(&s); s.es=s.ds; int86(0x33,&i,&i); } |