Jump to content
  • Advertisement
Sign in to follow this  
deathwearer

[.net] C# 2.0 Key dectection

This topic is 4012 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I need to detect if at the present moment the shit key is press. Problem is I don't want to use Keys events. I'd like to know if there is another way around. Thank

Share this post


Link to post
Share on other sites
Advertisement
You could PInvoke the GetAsyncKeyState() function, assuming you aren't targeting Mono. That would look something like:

[DllImport("user32.dll")]
static extern short GetAsyncKeyState(Keys vKey);

Share this post


Link to post
Share on other sites
I have never used this, but I think that VB .Net has a namespace called "My", which contains a Keyboard class. You can reference this from C# code, provided you can find which assembly it resides in.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!