8086汇编鼠标右键中断

发布于 2024-08-24 19:15:07 字数 81 浏览 4 评论 0原文

我正在 Windows 机器上进行 8086 程序集的项目,我需要知道单击了哪个鼠标按钮。这有什么中断?或者我该如何找到这个?

谢谢

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 finding this out?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

行雁书 2024-08-31 19:15:07

如果你正在制作一个在 Windows 下运行的 DOS 程序,你可以使用软件中断 0x33,函数 3,它返回 BL 寄存器中的按钮状态:

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

更多信息在这里 http://www.ctyme.com/intr/rb-5959.htm

如果您正在制作本机 Windows 应用程序,则可以测试通过检查传递到程序创建的主窗口的注册 WndProc 的标准鼠标按钮消息(WM_LBUTTONDOWN/UP、WM_RBUTTONDOWN/UP、WM_MBUTTONDOWN/UP)来按下按钮。

WndProc 的函数声明为“LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);”,消息类型在 uMsg 中传递,因此您需要检查 [esp+12] 处的 DWORD 并进行比较与您要处理的消息 ID 一起使用。

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.

一抹微笑 2024-08-31 19:15:07

在“DOS”计算机上,查看软件中断 0x33< /a>.
命令 AH = 0x03 返回寄存器 CX 中按下的鼠标按钮(以及其他寄存器中的鼠标坐标和其他信息)。

如果可用的话,使用 Windows API 来实现此目的当然要容易得多,如 matja 的答案所示。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文