> 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.