CWnd::OnLButtonDown afx_msg void OnLButtonDown( UINT nFlags, CPoint point );ParametersnFlagsIndicates whether various virtual keys are down. This parameter can be any combination of the following values: 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. pointSpecifies the x- and y-coordinate of the cursor. These coordinates are always relative to the upper-left corner of the window.
if(nFlags == MK_SHIFT) MessageBox("shift key is down");
afx_msg void OnLButtonDown( UINT nFlags, CPoint point );ParametersnFlagsIndicates whether various virtual keys are down. This parameter can be any combination of the following values: 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.
pointSpecifies the x- and y-coordinate of the cursor. These coordinates are always relative to the upper-left corner of the window.
MessageBox("shift key is down");
if(nFlags&MK_SHIFT)// 用 位操作 &
if(GetKeyState(VK_SHIFT) & 0x80)
{
SetCursor(m_hCursorZoomOut);// 按下
}
else
{
SetCursor(m_hCursorZoomIn); // 放开
}
{
if( pMsg->message == WM_LBUTTONDOWN )
{
if(pMsg->hwnd == GetDlgItem(IDC_EDIT1)->m_hWnd)
{
if(::GetKeyState(VK_SHIFT) < 0)
{
AfxMessageBox("按下shift");
}
else
AfxMessageBox("未按下shift");
return TRUE;
}
}
return CDialog::PreTranslateMessage(pMsg);
}