views:

102

answers:

0

I have a custom tabbed style control, and internally it works by showing or hiding the relevant page when you click on a tab.

The basic order of things that happen when you click a tab is

  1. Bring relevant page to front
  2. Show relevant page (by calling SetWindowPos with the appropriate flags)
  3. Hide the old page that we just covered up
  4. Repaint the window

Some of my tabs are rendered with DirectX. Under Windows XP everything works fine and there's no flicker when you switch between tabs. Under Windows 7 though (or Vista), the call to SetWindowPos in step 2 redraws the window, and there's a flash of uninitialized pixels before step 4, usually whatever was on the desktop before my app started running.

This only happens with the DirectX pages, but I'm not sure what it is about DirectX that would cause this, if anything - there are other differences between the pages as well, that was just the obvious pattern. I'm not sure if this is a real clue or a red herring.

The GDI pages don't repaint until step 4. I stepped through the code and checked - it's not just that the DWM uses a correctly cached bitmap in step 2 - it really doesn't repaint at all until step 4.

That's the background info, but at the moment I'm not sure how to tackle this specific problem, so my question is more general:

What are all the things that can affect SetWindowPos's decision to repaint or not?