Getting input without using a wndproc

Started by
3 comments, last by joe_bubamara 16 years, 2 months ago
Is there a way on windows to get keyboard input without using a wndproc? Basically im creating a UI library and want my UI library to do its own input so the user doesnt have to give the library input. Thanks
Advertisement
You can use GetAsyncKeyState(), but it's pretty horrible and won't handle e.g. upper and lower case translation.

Getting the application to pass in input seems reasonable to me?
You can use some of the functions listed here, but without using a wndproc function, you won't know the order at which the keys were pressed (I think).
Thanks a lot for the ideas. I looked at all those functions and don't really like them. I've decided to listen to Evil Steve and let the user pass on input
Quote:Original post by JasonBaldwin
Is there a way on windows to get keyboard input without using a wndproc? Basically im creating a UI library and want my UI library to do its own input so the user doesnt have to give the library input.

Thanks


In order to open a window on win32 platform, you need a winproc. So you don't earn a lot if you start reading input with lower level functions. You will just repeat the work that win32 already is doing for you. Instead of redoing the work of reading input, which is quite ugly to do, just "abstract" winproc away. For ex. get input in WM_INPUT as raw input, and then pass it to your own input routine, which is the only one that UI will ever see. That way (by just passing raw input to your own code), WinProc is hidden in your "platform" code and is never seen or known by any user code. That is the way I have seen it mplemented in many GUI or game windowing libraries. If you don't want to redo the work of formatting the input (checking if the user holds for example shift while he is pressing 'a' to get an 'A' and similar) you might rather register for some other messages then wm_input and then pass the input from those to your input routine.

This topic is closed to new replies.

Advertisement