OK, I'm having trouble managing the transition from fullscreen to windowed modes using D3D9, and the impact of this on Aero/DWM themeing of the window's non-client area.
Switching from windowed to fullscreen is OK. Switching between windowed modes is OK. Switching from windowed to fullscreen is OK. The specific problem is with switching from fullscreen to windowed modes, and it's consistent whether I start fullscreen then switch to windowed, or start windowed, switch to fullscreen, then back.
As part of the switch back to windowed, D3D9 disables Aero on the non-client region of the window. It doesn't disable Aero entirely, it on does so on the window itself.
Tracking the messages, I can see that I get a WM_DWMNCRENDERINGCHANGED with WPARAM 0 during a transition to fullscreen - so it's evident that D3D9 disables Aero at this point. I don't get one when transitioning back.
Using DwmSetWindowAttribute with DWMWA_NCRENDERING_POLICY and DWMNCRP_ENABLED as part of the mode change (just after the D3D device has completed recovery) I get a succeeded HRESULT but no intended effect (nor does a WM_DWMNCRENDERINGCHANGED message arrive).
Querying with DwmGetWindowAttribute and DWMWA_NCRENDERING_ENABLED confirms that non-client rendering remains disabled.
I know that I can bypass all of this by just using D3DCREATE_NOWINDOWCHANGES but then I get to have to mess around with controlling the mouse, managing focus and other nonsense, which is a hell of a lot more work. It seems obvious that there should be a way to get proper non-client rendering back, but what on earth could that way be?