根据组合标志来判断,例如:鼠标左键是否按下 if ( (nFlags & MK_LBUTTON) == MK_LBUTTON)
具体的标志有: · MK_CONTROL Set if the CTRL key is down. //CTRL键 · MK_LBUTTON Set if the left mouse button is down.//鼠标左键 · MK_MBUTTON Set if the middle mouse button is down.//鼠标中键 · MK_RBUTTON Set if the right mouse button is down.//鼠标右键 · MK_SHIFT Set if the SHIFT key is down. //SHIFT键
左键定义是:void OnLButtonDown( UINT nFlags, CPoint point ); 对参数的定义是: nFlags:判别是否左击了。 值从下面选取: MK_CONTROL Set if the CTRL key is down. MK_LBUTTON Set if the left mouse button is down. MK_MBUTTON Set if the middle mouse button is down. MK_RBUTTON Set if the right mouse button is down. MK_SHIFT Set if the SHIFT key is down. point:判断坐标位置的。包括x,y。以左上角为基准点。
if ( (nFlags & MK_LBUTTON) == MK_LBUTTON)
· MK_CONTROL Set if the CTRL key is down. //CTRL键
· MK_LBUTTON Set if the left mouse button is down.//鼠标左键
· MK_MBUTTON Set if the middle mouse button is down.//鼠标中键
· MK_RBUTTON Set if the right mouse button is down.//鼠标右键
· MK_SHIFT Set if the SHIFT key is down. //SHIFT键
对参数的定义是:
nFlags:判别是否左击了。 值从下面选取:
MK_CONTROL Set if the CTRL key is down.
MK_LBUTTON Set if the left mouse button is down.
MK_MBUTTON Set if the middle mouse button is down.
MK_RBUTTON Set if the right mouse button is down.
MK_SHIFT Set if the SHIFT key is down.
point:判断坐标位置的。包括x,y。以左上角为基准点。
还要加个判断,是不是按下你所指的按钮
GetFocus()->GetDlgCtrlID() == IDC_BUTTON