|
-
October 6th, 2010, 10:14 AM
#1
GetKeyState function in C#
Dear Code Gurus,
I have been just recently converted to C# from C++ and I am still trying to learn new concepts. In C++ there was a function that provided me with an answer about the state of a certain keyboard keys instantly - I only used this function to decide if a certain key is pressed or not. For example, to see if a SHIFT key down I used the following code in C++:
Code:
BOOL ShiftKeyDown = (::GetKeyState(VK_LSHIFT)<0 || ::GetKeyState(VK_RSHIFT)<0);
Is there something like that available in C#? If not, what is the best way to find out if a particular key is down or not?
So far, I only found one solution to that using KeyDown and KeyUp events but it sort of seems to complicated for me.
Thank you for your help!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|