最终,当我使用汇编语言左键单击鼠标但没有找到任何有用的技巧时,我试图选择一个按钮。任何帮助将不胜感激!该计划的代码如下。
INCLUDE IRVINE32.inc
INCLUDELIB kernel32.lib
INCLUDELIB user32.lib
INCLUDELIB Winmm.lib
INCLUDELIB Windows.lib
INCLUDELIB kernel32.lib
INCLUDELIB gdi32.lib
WinMain proto :DWORD,:DWORD,:DWORD,:DWORD
ExitProcess PROTO STDCALL :DWORD
WM_LBUTTONDOWN EQU 0x0201
.data
prompt BYTE "Mouse Not Pressed",0
message BYTE "Mouse pressed",0
MouseClick db 0
WM_LBUTTONDOWN bytE 0x0201
.code
main PROC
mov edx, OFFSET message
.IF WM_LBUTTONDOWN == true
Call WriteString
.ENDIF
mov edx, OFFSET prompt
Call WriteString
invoke ExitProcess, 0
main ENDP
END main
答案 0 :(得分:3)
感谢MichaelW我可以根据您的需求建立一个示例:
include irvine32.inc
.data
hStdIn dd 0
nRead dd 0
_INPUT_RECORD STRUCT
EventType WORD ?
WORD ? ; For alignment
UNION
KeyEvent KEY_EVENT_RECORD <>
MouseEvent MOUSE_EVENT_RECORD <>
WindowBufferSizeEvent WINDOW_BUFFER_SIZE_RECORD <>
MenuEvent MENU_EVENT_RECORD <>
FocusEvent FOCUS_EVENT_RECORD <>
ENDS
_INPUT_RECORD ENDS
InputRecord _INPUT_RECORD <>
ConsoleMode dd 0
Msg db "Click! ",0
Msg2 db "Esc ",0
.code
main PROC
invoke GetStdHandle,STD_INPUT_HANDLE
mov hStdIn,eax
invoke GetConsoleMode, hStdIn, ADDR ConsoleMode
mov eax, 0090h ; ENABLE_MOUSE_INPUT | DISABLE_QUICK_EDIT_MODE | ENABLE_EXTENDED_FLAGS
invoke SetConsoleMode, hStdIn, eax
.WHILE InputRecord.KeyEvent.wVirtualKeyCode != VK_ESCAPE
invoke ReadConsoleInput,hStdIn,ADDR InputRecord,1,ADDR nRead
movzx eax,InputRecord.EventType
cmp eax, MOUSE_EVENT
jne no_mouse
test InputRecord.MouseEvent.dwButtonState, 1
jz no_mouse
lea edx, Msg
Call WriteString
jmp done
no_mouse:
.ENDW
lea edx, Msg2
Call WriteString
done:
mov eax, ConsoleMode
invoke SetConsoleMode, hStdIn, eax
call ReadChar
invoke ExitProcess, 0
main ENDP
end main