ALT+TAB in Vista activates main window instead of

2019-08-03 04:09发布

问题:

My app (written in C++) uses Win32 (not MFC) to create a couple of windows with CreateWindowEx. The main window gets the desktop as parent, the child windows get the main window as parent.

my problem:

  • my app has an active child window
  • I switch to another app (per click, ALT+TAB or other, doesn't matter)
  • I switch back to my app with ALT+TAB

Now the main window of my app is activate, not the child window anymore. If I switch back clicking the taskbar entry, the child window remains active.

This happens only with Aero (with and without Glass). If I activate the classical Window Scheme, everything behaves as under Windows XP (switching back with ALT+TAB leaves the child window active).

Any suggestions or links or other resources?

(Sample code is a bit hard to provide, since the UI-elements are wrapped in classes with own data types for strings etc.)


It seems that Vista with classical scheme sends an WM_ACTIVATE to the main window and another WM_ACTIVATE to the second window (owned by the main window). With Vista Aero enabled only the main windows gets an WM_ACTIVATE. Odd.