+1  A: 

I can't say that I'm 100% certain about the situation you're experiencing. However, my guess is it's because most D3D/OpenGL games will change the resolution of your machine when they startup/shutdown for performance reasons.

The ones you see that don't shuffle the windows around are likely not changing the resolution because they may be able to run at your current settings.

dustyburwell
ok, I've added more clarification to the question. It does not seem to be resolution related but more to the "remembering" of desktop/windows sizes and positions before and after restoration.
Keyframe
A: 

Hm, I've gone through some more research about this - it looks like there is no default fallback on restoring all running windows sizes and positions after changing resolution, so it must be done from within an application (at least in XP).

So, in order to gracefully return back from other resolution (full screen game for example), I would need to get all running applications hWnd's with EnumWindows and appropriate callback and store each of the windows RECT structure via GetWindowRect in a list.

When switching back to desktop resolution I would EnumWindows again, but with a different callback which sets each of the running application windows position and size with SetWindowPos, using the list of RECTs I've saved before switching to full screen.

There are gotcha's, ofcourse, like watching you get a window hwnd only through EnumWindows etc. It seems odd that OS doesn't provide a feature like that, even if only API. I wonder how other OS's out there handle this, if they handle it at all.

Keyframe
+1  A: 

Shouldn't you be using ChangedDisplaySettingsEx(..., CDS_FULLSCREEN, NULL)? That will tell the system the resolution swap is temporary.

MSN