Does anyone know about WM_SETFOCUS and EN_SETFOCUS
Bill Medland
billmedland at mercuryspeed.com
Wed Oct 1 12:05:27 CDT 2003
On October 1, 2003 12:51 am, Gerhard Gruber wrote:
> > Is anyone out there an expert in Windows focus handling?
> >
> > I have problems with our application and the focus handling in places.
> >
> > Basically it seems to me that there is some sort of logic in windows
> > whereby
> > the code calls PostMessage (WM_SETFOCUS) but the result is that the
> > parent of
> > the target window receives WM_COMMAND EN_SETFOCUS instead.
> >
> > Does anyone know anything about such translations?
>
> From MSDN:
>
> The EN_SETFOCUS notification message is sent when an edit control receives
> the keyboard focus. The parent window of the edit control receives this
> notification message through a WM_COMMAND message.
>
> LRESULT CALLBACK WindowProc(
> HWND hwnd, // handle to window
> UINT uMsg, // WM_COMMAND
> WPARAM wParam, // edit control identifier, EN_SETFOCUS
> LPARAM lParam // handle to edit control (HWND)
> );
> Parameters
> wParam
> The low-order word specifies the edit control identifier.
> The high-order word specifies the notification message.
>
> lParam
> Handle to the edit control.
> Remarks
> The parent window will always get a WM_COMMAND message for this event, it
> does not require a notification mask sent with WM_SETEVENTMASK.
>
> Rich Edit: For information about the compatibility of rich edit versions
> with the various system versions, see About Rich Edit Controls.
Thanks for taking the time to reply.
Yes, I know about that.
Also see the SetFocus documentation that says it sends WM_SETFOCUS.
So maybe they mean that it sends a WM_SETFOCUS unless its an edit control in
which case it sends EN_SETFOCUS.
So what exactly is an edit control. i.e. what is the queriable property that
allows us to decide which to send.
There is a suggestion that actually this translation is done down in the
DefWindowProc somewhere. (See
http://groups.google.ca/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=%235vMQagTDHA.1288%40tk2msftngp13.phx.gbl
)
I see that currently we don't do anything with WM_SETFOCUS in DefWindowProc.
--
Bill Medland
ACCPAC International, Inc.
medbi01 at accpac.com
Corporate: www.accpac.com
Hosted Services: www.accpaconline.com
More information about the wine-devel
mailing list