Hello,
I am trying to make a keybind program, but in order for it to work, I have to check if a certain key is pressed while another window has the focus, and then simulate what the users has entered. I am successfully able to simulate keypress, but I cant manage to detect it outside the main window. Its a keybind program for the game Grand Theft Auto: San Andreas, so I could check if the name of the window contains "San Andreas", then check if a certain key is pressed while that last windows has the focus, it would be helpfull. Ive searched for ages on Google and MSDN, and I am not able to find anything. Help would be apreciated.
Thanks.

Detecting keypress outside the program windows?
Chris Honcoop
Generally speaking, the window that has focus is where your events need to be. In your case you are attempting to read a keydown event in you popup window.
So, put your keydown event in your pop up window, and have it call a method in your main window or better yet, create a keydown event class.
I'm not sure what your code really looks like, but I imagine you will need to pass the sender and the KeyEventArg to your method...
Prashweenet
Daudi
Alex.
craigman
Hello, Alex
It can be done in C++ by using win32 api, it's quite true.
Also we can do it in C# by using win32 api, just interoperate with particular win32 api to get key.
About platform invoke issue, you'd reference to: http://www.c-sharpcorner.com/UploadFile/shrijeetnair/win32api12062005005528AM/win32api.aspx
http://www.developerland.com/CSharpGeneral/General/146.aspx
Thanks