From: navi2000 on
Hi group!

I'm writting an application and I need to know when user changes tasks
(ALT-TAB, for instance). The application is a full screen DirectDraw
app.
I need to know when the user activates the application and when the
user changes to other application.
First I've tried to capture WM_SETFOCUS and WM_KILLFOCUS messages, but
windows is sending these messages a lot of times, not only when really
is changing the focus.

Do you know any way to do it easily?
Thanks
From: Kellie Fitton on
On Jul 4, 9:29 am, navi2000 <ivan.ga...(a)gmail.com> wrote:
> Hi group!
>
> I'm writting an application and I need to know when user changes tasks
> (ALT-TAB, for instance). The application is a full screen DirectDraw
> app.
> I need to know when the user activates the application and when the
> user changes to other application.
> First I've tried to capture WM_SETFOCUS and WM_KILLFOCUS messages, but
> windows is sending these messages a lot of times, not only when really
> is changing the focus.
>
> Do you know any way to do it easily?
> Thanks



Hi,

Since the video mode have changed with task switching Alt+Tab,
you need to call Restore() on each of your surfaces, including
front buffer, back buffers and in-memory surfaces. Most of the
DirectDraw video game samples handles the following Windows
messages to restore all surfaces upon task switching:

WM_ACTIVATEAPP

WM_ACTIVATE

http://msdn2.microsoft.com/en-us/library/ms632614.aspx

http://msdn.microsoft.com/en-us/library/ms646274(VS.85).aspx

Kellie.