Re: Controls - Not receiving key messages ON_WM_KEYDOWN
"Nobody" wrote:
Hi Arman,
Make your post more informative ...
I kind of try speaking to an audience, so I omit certain details which I see as being too trivial.
I am the overzealous type. I guess I speak too quickly sometimes. Must be the coffee.
Nice.
Fortunately, we all are human beings and not machines :)
What do you mean by saying 'in my control'?
Precisely that. I just learned how to roll my own controls, so I have been making a few controls.
It's kind of cool untill problems arise, but hey. I am learning.
Again, I've got no clue what your control is about.
Why not to use message-handlers instead of PretranslateMessage?
Because Message handlers don't work and in my case, and neither does checking for WM_KEYDOWN in PretranslateMessage().
I don't know if it is a Window Style issue or other.
If you did not mistype, then you did not override PreTranslateMessage. Make
sure you're function's name is corect.
Maybe you can tell me something about the Message Map Macros.
When I send/post and receive messages, they are in the format (WPARAM wParam, LPARAM lParam).
When MFC receives messages, they are not in that format, they are more relevant. ex. OnMouseMove(int nFlags, CPoint point)
I am curious as to what is going on between the two.
This is the best I can figure.
Do you know if it doing something like this, which we don't see? Or something else that I am not familiar with?
OnMsgMouseMove(WPARAM wParam, LPARAM lParam)
{
CPoint point;
point.x = (HIWORD)lParam;
point.y = (LOWORD)lParam;
int nFlags = wParam;
OnMouseMove(int nFlags, CPoint Point);
}
It's not a big issue, because that is what I am doing. I am just curious to know how MFC does it.
Ok. The way MFC handlers present their argumnts is supposed to be more
convenient than the standard 'WPARAM,LPARAM' way. Note that I say 'it is
supposed'. If you think you need those PARAMs, then MFC gives you the method
to get them;
const MSG *CWnd::GetCurrentMessage();
Call this function inside [and only inside ] your handlers and you will get
a pointer to the underlying MSG structure. You wanted this, right?
I would like to know how to make my own macros if possible.
One of the best ways to learn MFC is to look into its source code.
--
======
Arman