8086 assembly right mouse click interrupts

前端 未结 2 1115
被撕碎了的回忆
被撕碎了的回忆 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 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.

提交回复
热议问题