Determine if a key is pressed

I need to determine if a key is pressed. I do not need an event to shoot, I just need to determine if a key is pressed to determine the path to the code. I looked around and there are cool GlobalKeyHook classes, but they are event based.

A small example, basically I need to determine if the user holds the key when my application starts, and if so, the application does one, the other reasonably starts as usual. Does anyone have any ideas?

+4
source share
2 answers

Check out this post if you have trouble checking the status of the keyboard when you launch the application.

Get keyboard status in WPF application in Main-Method at startup

Check out the second senior post, showing how to do it with DLLImport

+2
source

As soon as I asked the question, I found the answer. This post was what I needed. How to determine the current key pressed?

Thanks Patrick

+1
source

All Articles