注册 登录
编程论坛 汇编论坛

Asm菜鸟问问题

crosoli 发布于 2009-10-12 12:42, 614 次点击
IF uMsg==WM_LBUTTONDOWN
        mov eax,lParam
        and eax,0FFFFh

处理WM_LBUTTONDOWN的时候,把lParam的数据mov到EAX中,为什么还有一个AND EAX,0FFFFH呢? AND后数据不还是一样?
难道是LPARAM的数据不是32位格式的,格式化成32位吗? 初次接触汇编,望解答.
2 回复
#2
sll08072009-10-12 16:16
lParam
The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.  
 
The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.  


低字节表示光标的X坐标

高字节表示光标的Y坐标

and eax,0ffffh

保留低16位 高16位清零

取X点坐标!~~

[ 本帖最后由 sll0807 于 2009-10-12 16:19 编辑 ]
#3
onepc2009-10-12 16:17
这个lparam存的是鼠标的xy坐标。
是32位的
and eax,0ffffh之后取的值是低16位的数据,高16位是好像是Y的,在这里置0了,所以eax在and之后的值就是X的坐标了。
1