Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

When Does WM_SETFOCUS Not Set Focus?

173 views
Skip to first unread message

Larry Lindstrom

unread,
Apr 27, 2008, 4:25:07 AM4/27/08
to
Hi Folks:

I have an MDI application that I'm making behave in a way an
MDI app was never intended to behave.

What could go wrong? :)

I could fill a page describing what I'm trying to do, but it
breaks down to building my own desktop inside of an MDI frame.
This means maintaining multiple parent-modal child relationships,
let's call them tasks. As is described in Google's archives for
this group, having a child disable it's parent is a common
method to maintain a parent-modal child relationship among the
children of an MDI frame.

A stack is built with the handles of each MDI child and
DeferWindowPos() is used to place the window to be active
and in focus at the top of the Z order. I use
EnableWindow(, TRUE) followed immediately by SetFocus() to
bring the MDI child into focus.

This works almost perfectly. But in certain, repeatable,
situations the window is enabled, but doesn't receive focus,
with the darker blue frame.

I write entries to a log and it shows a WM_SETFOCUS is
received by the MDI child. No WM_KILLFOCUS is received, so
why doesn't this top of the Z order MDI child window have
focus?

Thanks
Larry

JussiJ

unread,
Apr 28, 2008, 11:32:17 PM4/28/08
to
On Apr 27, 6:25 pm, Larry Lindstrom <nob...@nowhere.com> wrote:

>     I write entries to a log and it shows a WM_SETFOCUS is
> received by the MDI child.  No WM_KILLFOCUS is received, so
> why doesn't this top of the Z order MDI child window have
> focus?

Make when the MDI child window is activated that you do
a SetFocus call to give the focus to the client window
of the MDI child window (i.e the window inside the frame of
the MDI child window).

Jussi Jumppanen
Author: Zeus for Windows IDE
http://www.zeusedit.com

0 new messages