[MSWIN32] Trouble with mouse programming

N

Nobby Golder

Hello friends

I am trying to run this simple test program to on my WinXP, but
every time I try to run it just crashes. I have also tested couple of
programs from Net on my machine but they also seem to fail. I reckon
that WinXP does not allow me to set up a mouse handler.


#include <stdio.h>
#include <dos.h>
#include <conio.h>


const int MOUSE_INT_MASK = 0x15;
union REGS i, o;
union SREGS sr;


void far interrupt mouse_handler()
{


printf("You did something with mouse\n");



}


int init_mouse()
{
int i;
asm {
mov ax, 0;
int 0x33;
mov i, ax

}
return i;



}


void show_mouse() {

asm {
mov ax, 0x1;
int 0x33;
}



}


void mouse_init( )
{
unsigned short seg = FP_SEG(mouse_handler);
unsigned short off = FP_OFF(mouse_handler);
/* convert the below to assembly */
i.x.ax = 0x0C;
i.x.cx = MOUSE_INT_MASK;
i.x.dx = off;
sr.es = seg;
int86x(0x33, &i, &o, &sr);


}


void main()
{
clrscr();

init_mouse();
show_mouse();
mouse_init();
while(!kbhit())
continue;
}
 
S

Seebs

Hello friends

I am trying to run this simple test program to on my WinXP, but
every time I try to run it just crashes. I have also tested couple of
programs from Net on my machine but they also seem to fail. I reckon
that WinXP does not allow me to set up a mouse handler.

That may well be. You might find a newsgroup related to Windows programming
better suited to answering your question, though, as there's nothing remotely
related to the C language here, just a bunch of questions about a particular
operating system.

-s
 
K

Keith Thompson

Nobby Golder said:
I am trying to run this simple test program to on my WinXP, but
every time I try to run it just crashes. I have also tested couple of
programs from Net on my machine but they also seem to fail. I reckon
that WinXP does not allow me to set up a mouse handler.
[snip]

Try asking in comp.os.ms-windows.programmer.win32.
 
K

Kaz Kylheku

Hello friends

I am trying to run this simple test program to on my WinXP, but
every time I try to run it just crashes.

Yes it does. And you know what else? Reagan isn't U.S. President any longer.

You should try to get your life together first, before worrying about mice
under Windows.

Things changed a lot since you fell into that coma in 1986, and not only in PC
programming.
 
N

Nobody

I am trying to run this simple test program to on my WinXP, but
every time I try to run it just crashes. I have also tested couple of
programs from Net on my machine but they also seem to fail. I reckon
that WinXP does not allow me to set up a mouse handler.

The code is written for DOS. It would (presumably) work on DOS, or on
the versions of Windows which run on top of DOS (Win3.1, Win95/98/ME).

It won't work on any NT-based version of Windows (NT,2K,XP,Vista,7).
These don't support real-mode 8086 code. Try DOSbox, DOSemu, etc.

Further questions should probably go to comp.os.msdos.programmer.
 
B

Beej Jorgensen

I am trying to run this simple test program to on my WinXP, but
every time I try to run it just crashes. I have also tested couple of
programs from Net on my machine but they also seem to fail. I reckon
that WinXP does not allow me to set up a mouse handler.

My Dearest Nobby:

Here are some answers to your exact question which appeared on Usenet
word-for-word in April 2004:

http://groups.google.com/group/comp.os.msdos.programmer/browse_frm/thread/fbcdd9309f25a6b8

Merry Xmas &c.,
-Beej
 
J

jacob navia

Nobby Golder a écrit :
Hello friends

I am trying to run this simple test program to on my WinXP, but
every time I try to run it just crashes. I have also tested couple of
programs from Net on my machine but they also seem to fail. I reckon
that WinXP does not allow me to set up a mouse handler.

This program is written for the MSDOS operating system,
that has ceased to exist more than 15 years ago (more or less).

That's why it doesn't work.

Try to get the documentation for windows xp, get a 32
bit compiler and use the windows API. Then you can setup
a mouse "handler" as you wish.

jacob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,954
Messages
2,570,116
Members
46,704
Latest member
BernadineF

Latest Threads

Top