Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Mouse Routines

I was hoping could assist me in a new program. I'm pretty sure I'll have to use the mouse for this. If anyone could tell me how to use the mouse in QBasic i'd be grateful


Comments

  • : I was hoping could assist me in a new program. I'm pretty sure I'll have to use the mouse for this. If anyone could tell me how to use the mouse in QBasic i'd be grateful

    :



    OK, First, Load Qbasic with QB.qlb

    EX: QB.exe /l QB.QLB



    Then, you must use DOS interrupts, there are 256 interrupts, and they have services.



    You will need to access these interrupts with a type

    EX:

    type regtype

    ax as integer

    bx as integer

    cx as integer

    dx as integer

    si as integer

    di as integer

    bp as integer

    flags as integer

    end type

    dim regs as regtype



    'reset mouse

    regs.ax = 0

    call interrupt(&h33, regs, regs)

    'this code is optional, dos auto-sets borders

    'but you might want custom borders

    'set x borders

    regs.ax = 7

    regs.cx = x1

    regs.dx = x2

    call interrupt(&h33, regs,regs)

    'set y borders

    regs.ax = 8

    regs.cx = y1

    regs.dx = y2

    call interrupt(&h33, regs,regs)



    'ok, now for the cursor

    'display a cursor ax = 1, invisible cursor ax = 3

    regs.ax = 1

    call interrupt(&h33, regs, regs)



    'end example



    ok now to input from the mouse!

    'update

    EX:

    regs.ax = 3

    call interrupt(&h33, regs, regs)

    xpos = regs.cx

    ypos = regs.dx

    click = regs.bx

    'if click = 1 left click

    '2 right click

    '3 both are clicked

    'end example



    I hope this helped, it might be advanced, contact me for help!



    Keep On Programming!!!




Sign In or Register to comment.