Check if the LButton mouse is disabled?

How to check if the "Left Button" button of the mouse is currently pressed or drag something (I prefer the first option).

I tried Mouse.IsDraging, but there was no result.

NOTE. I process mouse messages in my application, so no problem if its WM, just pass a way to complete my task.

+5
source share
2 answers

There is a Windows API function GetAsyncKeyState()that, despite its name, can also use the state of mouse buttons. The related documentation directly contains the answer to your question:

GetAsyncKeyState . , , , . , GetAsyncKeyState(VK_LBUTTON) , , . , GetSystemMetrics(SM_SWAPBUTTON), TRUE, .

short, , , .

+20
OnMouseMove(UINT nFlags, CPoint point)
{
  m_LButtonPressed=nFlags & MK_LBUTTON;
  CWnd::OnMouseMove(nFlags, point);
} 
0

All Articles