C# Question

Can I determine whether a Ctrl key press is Left Ctrl or Right Ctrl?

I want to determine whether a CTRL key is LEFT CTRL or RIGHT CTRL key when it is pressed. How can I do this?

Answer Source

AFAIK you can't access this information from within .net.

However, you can use the Win32 API GetAsyncKeyState to test if specific keys are currently down, and this can differentiate the left and right ctrl keys. (If you're writing a game this is more likely to work well for you than Keydown handlers, as GetAsyncKeyState tests whether the key is down "now" rather than whether it was pressed "at some time in the past", which gives considerably better responsiveness).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download