8086组件右键单击中断 [英] 8086 assembly right mouse click interrupts
问题描述
我正在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?
谢谢
推荐答案
如果要制作在Windows下运行的DOS程序,则可以使用软件中断0x33,函数3,该函数返回BL寄存器中的按钮状态:
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
此处有更多信息 http://www.ctyme.com/intr/rb- 5959.htm
如果您正在制作本机Windows应用程序,则可以通过检查传递到注册WndProc的标准鼠标按钮消息(WM_LBUTTONDOWN/UP,WM_RBUTTONDOWN/UP,WM_MBUTTONDOWN/UP)来测试按钮是否按下,以创建主窗口通过您的程序.
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.
WndProc的函数声明为"LRESULT CALLBACK WindowProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam);",消息类型以uMsg传递,因此您需要在[esp + 12中检查DWORD ],然后将其与您要处理的消息ID进行比较.
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.
这篇关于8086组件右键单击中断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!