I try to do screen pixel color picker and I want to copy pixel html color if user press [CTRL]+[ALT]+[C].
But this can be pressed out of application form. So I can't use keydown event of Form.
How can I do it? Maybe some API function?
I try to do screen pixel color picker and I want to copy pixel html color if user press [CTRL]+[ALT]+[C].
But this can be pressed out of application form. So I can't use keydown event of Form.
How can I do it? Maybe some API function?
You need something like this http://www.c-sharpcorner.com/UploadFile/ChrisBlake/HowToPre-FilterWindowsMessgaes11232005225819PM/HowToPre-FilterWindowsMessgaes.aspx
And here is list of codes http://wiki.winehq.org/List_Of_Windows_Messages
I have done it before with left click of mouse, but you have to see how to do it with keyboard.
Basically, you intercept every message your application gets, and filter the ones you need (by checking code value). I think you can wait for message which tells that keyboard button is pressed (any button), and then check pressed keys using Keyboard class.
if ((Keyboard.IsKeyDown(Key.LeftCtrl) ||
Keyboard.IsKeyDown(Key.RightCtrl)) &&
(Keyboard.IsKeyDown(Key.LeftAlt) ||
Keyboard.IsKeyDown(Key.RightAlt)) &&
Keyboard.IsKeyDown(Key.C))
{
//your code
}
https://msdn.microsoft.com/en-us/library/system.windows.input.keyboard(v=vs.110).aspx