8086 assembly right mouse click interrupts

前端 未结 2 1090
被撕碎了的回忆
被撕碎了的回忆 2021-01-16 12:26

I am working on a project in 8086 assembly on windows machine and I need to know which mouse button has been clicked. What are the interrupts for this? or how do I go about

相关标签:
2条回答
  • 2021-01-16 12:50

    On a "DOS" machine, look into Software Interrupt 0x33.
    Command AH = 0x03 returns the mouse button pressed in register CX (along with mouse coordinates and other info, in other registers).

    If available, it is of course much easier to user the Windows API for this purpose, as indicated in matja's answer.

    0 讨论(0)
  • 2021-01-16 13:13

    If you're making a DOS program that runs under windows, you can use software interrupt 0x33, function 3, which returns the button status in the BL register :

        mov   ax,0x3
        int   0x33
        test  bl,1
        jnz   left_button_pressed
        test  bl,2
        jnz   right_button_pressed

    More info here http://www.ctyme.com/intr/rb-5959.htm

    If you're making a native Windows application, you can test for button presses by checking for the standard mouse button messages (WM_LBUTTONDOWN/UP , WM_RBUTTONDOWN/UP , WM_MBUTTONDOWN/UP) passed to your registered WndProc for the main window created by your program.

    The function declaration for the WndProc is "LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);", the message type is passed in uMsg, so you'd check the DWORD at [esp+12] and compare it with the message ID you want to handle.

    0 讨论(0)
提交回复
热议问题