[MSWIN32] Trouble with mouse programming

Discussion in 'C Programming' started by Nobby Golder, Dec 23, 2009.

  1. Nobby Golder

    Nobby Golder Guest

    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;
    }
    Nobby Golder, Dec 23, 2009
    #1
    1. Advertising

  2. Nobby Golder

    Seebs Guest

    On 2009-12-23, Nobby Golder <> wrote:
    > 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
    --
    Copyright 2009, all wrongs reversed. Peter Seebach /
    http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
    http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
    Seebs, Dec 23, 2009
    #2
    1. Advertising

  3. Nobby Golder <> writes:
    > 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.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    Nokia
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
    Keith Thompson, Dec 23, 2009
    #3
  4. Nobby Golder

    Kaz Kylheku Guest

    On 2009-12-23, Nobby Golder <> wrote:
    > 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.
    Kaz Kylheku, Dec 23, 2009
    #4
  5. Nobby Golder

    Nobody Guest

    Re: [MSDOS] Trouble with mouse programming

    On Wed, 23 Dec 2009 20:56:03 +0000, Nobby Golder wrote:

    > 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.
    Nobody, Dec 23, 2009
    #5
  6. On 12/23/2009 12:56 PM, Nobby Golder wrote:
    > 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
    Beej Jorgensen, Dec 23, 2009
    #6
  7. Nobby Golder

    jacob navia Guest

    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
    jacob navia, Dec 23, 2009
    #7
  8. Nobby Golder

    Richard Bos Guest

    Nobby Golder <> wrote:

    It's CGRIIIISTMAAAASS!!!!

    > Hello friends
    >
    > I am trying to run this simple test program to on my WinXP, but


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


    It's also a particularly dumb troll.

    Richard
    Richard Bos, Dec 28, 2009
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    94
    Artco News
    Oct 22, 2003
  2. Useko Netsumi
    Replies:
    0
    Views:
    90
    Useko Netsumi
    Nov 5, 2003
  3. Javier Goizueta

    Numerical problems of mswin32 Ruby

    Javier Goizueta, Jan 20, 2004, in forum: Ruby
    Replies:
    0
    Views:
    96
    Javier Goizueta
    Jan 20, 2004
  4. Armin Roehrl
    Replies:
    1
    Views:
    108
    Jamey Cribbs
    Feb 13, 2004
  5. Useko Netsumi

    Ruby fcgi binaries for mswin32

    Useko Netsumi, Feb 19, 2004, in forum: Ruby
    Replies:
    0
    Views:
    77
    Useko Netsumi
    Feb 19, 2004
Loading...

Share This Page