Hi fellas,
I wanna make a program that is sensitive to the keys when its window is non selected. Its like some music player's global hotkeys. When im using another application, if i press a key my program must react. How can i do this? Does backgroundworker work for this? What do you advice me to use?
You should use a thread that checks GetAsyncKeyState, that works globally (application-wise) so you should use it to check for the hotkeys that you would like to use.
I heard of a "Global Keyboard Hook" using SetWindowsHookEx at one point, but GetAsyncKeyState would be much easier, imo.
Thanks bro. Can you give an example written in c#
i imported the method by this way:
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
public static extern short GetAsyncKeyState(int vkey);
However I can't use it in program correctly.
Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)