How to get get mouse button status independent of particulat application window status.
use the following API in C#:
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
public static extern short GetAsyncKeyState(int vkey);
here vkey is ASCII key and in C# this can be found in class "Keys" or get the info from goole search.
ex.
short ke= GetAsyncKeyState((int)Keys.LButton);
If ke==0 that means Left mouse button has not ben presses since lass call of above function
If ke==1 that means Left Mouse button has been presses and released since last call of above function
Else Left mouse button is still in pressesd status.
For more information please visit: http://msdn.microsoft.com/en-us/library/ms646293%28VS.85%29.aspx
No comments:
Post a Comment