What says Micro$oft about gamma correction in windowed mode:
Quote:


Starting with version DirectX 8.x, setting a gamma ramp has no effect unless the swap chain is full-screen. To change the gamma ramp in windowed mode, use the Microsoft Windows® Graphics Device Interface (GDI) function SetDeviceGammaRamp, which will impact the entire screen(not just the active window). SetDeviceGammaRamp will not allow "extreme" gamma ramps, such as an all red gamma ramp. In contrast, IDirect3DDevice9::SetGammaRamp will clean up the gamma ramp when the application is minimized or exits, and then restore it again when the application is restored.




As you can see, gamma ramp correcting in windowed mode is'nt good idea, you have to use other technique (may be camera.ambient for brightness, but it don't work with some shaders, applied to whole level). Or write fullscreen games !
And disable task swiching. And disable all system keys. And no exit item in menu. And...