would it be efficient to use GetKeyState(), to determine the input the user presses or is there another method. My idea was to get input only in the client, or maybe giving the user an option for custom control...
would it be efficient to use GetKeyState(), to determine the input the user presses or is there another method. My idea was to get input only in the client, or maybe giving the user an option for custom control...
Last edited by Darkinyuasha1; 06-18-2007 at 09:26 PM.
What kind of "windows" program are you creating?
If it's a regular windows program with a GUI window, then use the various WM_* messages to track what the user is doing.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
What i mean is instead of gui, i want controls to move an image (game control basically) i'm trying to handle key events
Last edited by Darkinyuasha1; 06-18-2007 at 11:16 PM.
You mean like "OK" and "Cancel" on a dialog?
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
You are being very hard to understand Darkinyuasha1. From the best I can tell, your looking for the WM_KEYDOWN notification; use it in your window's callback's message switch.
well i can use WM_KEYDOWN
using th wParam
or could i use GetKeyState()Code:WM_KEYDOWN: if(wParam == VK_LEFT) //do something
to capture an input key and then determine
what event i would do when the user presses it .
GetKeyState() is only if you expect the player to be pressing multiple keys simultaneously and you need to know which keys are pressed. This is useful when you have 'modifier' keys, such as SHIFT+D does something different than pressing the shift key then the D key seperatelyCode:case WM_KEYDOWN: switch(wParam){ case VK_LEFT: // do something here break; } break;
Last edited by abachler; 06-19-2007 at 11:43 AM.
ooooh thanks for clarifying i understand now..