Original Post
Here is the some source code from books
while (msg!=wm_quit)
{
if (peekmessage(&msg, Null, Null, Remove))
{
translatemessage();
dispatchmessage();
else
{
if (Frame() == false)
}
Frame()
{
m_Keyboard->getkeyboardStatus(Key_UP);
}
The source code is come from my mind, so, it may have syntas error, but you can think this is psuedocode.
The m_keyBoard is the direct input device.
Here is my question:
As my knolwedge, when a user input from keyboard, it will produce message from message Q in window process. At the same time, it also produce a key_XX from the buffer of direct input. Am I Correct first?
Using direct input instead of window is because the speed is faster than window. Therfore, when the user input from keyboard, which function will call first? Is Frame() function or dispatchmessage() first? If the dispatchmessage() first, so, I place the action to msgproc is better than place it in the Frame function? Therefore, the Frame() function become no meaningful because it cannot have the fastest action to do the specific event. Do you understand what I mean? Here is my idea:
1. User input(keyboard) --> peekmessage(true) --> call dispatchmessage() --> peekmessage(false) --> call frame()
Or
2. User input(keyboard) --> peekmessage(false) --> call Frame() --> peekmessage(true) --> dispatchmessage()
I hope you can understand what I mean. So, which approach is correct, or All I wrong, pls help me and tell me the answer, thx