22.02.2014 Views

with DOS/4GW? - Open Watcom

with DOS/4GW? - Open Watcom

with DOS/4GW? - Open Watcom

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>DOS</strong> Programming Guide<br />

#pragma off (check stack)<br />

void loadds far click handler (int max, int mcx, int mdx)<br />

{<br />

#pragma aux click handler parm [EAX] [ECX] [EDX]<br />

mouse event = 1;<br />

mouse code = max;<br />

mouse cx = mcx;<br />

mouse dx = mdx;<br />

if( mouse code & 8 ) right button = 1;<br />

}<br />

#pragma on (check stack)<br />

void main( void )<br />

{<br />

struct SREGS sregs;<br />

union REGS inregs, outregs;<br />

int installed = 0;<br />

int orig mode = 0;<br />

int far *ptr;<br />

int (far *function ptr)();<br />

segread(&sregs);<br />

/* get original video mode */<br />

inregs.w.ax = 0x0f00;<br />

int386( 0x10, &inregs, &outregs );<br />

printf( "Current Mode = %u\n",<br />

orig mode=outregs.h.al );<br />

/* check for mouse driver */<br />

inregs.w.ax = 0;<br />

int386 (0x33, &inregs, &outregs);<br />

if( installed = (outregs.w.ax == -1) )<br />

printf( "Mouse installed...\n" );<br />

else<br />

printf( "Mouse NOT installed...\n" );<br />

if( installed ) {<br />

/* goto graphics mode */<br />

inregs.h.ah = 0x00;<br />

inregs.h.al = 0x4;<br />

int386( 0x10, &inregs, &outregs );<br />

/* show mouse cursor */<br />

inregs.w.ax = 0x1;<br />

int386( 0x33, &inregs, &outregs );<br />

/* set mouse cursor form */<br />

inregs.w.ax = 0x9;<br />

inregs.w.bx = 0x0;<br />

inregs.w.cx = 0x0;<br />

ptr = cursor;<br />

inregs.x.edx = FP OFF( ptr );<br />

sregs.es = FP SEG( ptr );<br />

int386x( 0x33, &inregs, &outregs, &sregs );<br />

34 How Can I Use the Mouse Interrupt (0x33) <strong>with</strong> <strong>DOS</strong>/<strong>4GW</strong>?

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!