Re: How to set focus to the previous app that had it?
- From: "David Ching" <dc@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 1 Jun 2007 09:08:37 -0700
"Kerry" <Kerry@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:7BD48F63-F7D5-4EB9-B38A-84A6C357231A@xxxxxxxxxxxxxxxx
When my app first starts, it's going to grab the focus. I want to
immediately give focus back to the previous app that had it
It's easier not to grab the focus to begin with. Call ShowWindow
(SW_SHOWNOACTIVATE) and your window won't steal the focus.
Also, if somebody uses the mouse to interact with my app (drag etc), it
will
again grab the focus. When the user is done dragging, I'd again like to
immediately give focus back to the app it grabbed it from.
This is tricky. I tried storing the HWND passed to your OnSetFocus() which
is the window that previously had the focus. After the drag, call
SetForegroundWindow() for this HWND. But this didn't work. I think the
window wasn't accurate.
I think I ended up saving the old HWND in OnSetCursor(). But this was
awhile ago.
-- David
.
- Prev by Date: Re: Rounding of the double
- Next by Date: Re: Rounding of the double
- Previous by thread: Re: Copying Bitmap
- Next by thread: Re: How to set focus to the previous app that had it?
- Index(es):
Relevant Pages
|