ALT - TAB Problem

In my Windows-OpenGL Application I encounter several problems after I´ve pressed ALT-TAB.
Firstly the mouse-cursor is fixed to the center (as I coded this for a shooter)…so the code must still be executed. How can I detect in my program that the user is in alt-tab?
And then when I switch back to my program…everything seems to be rendered correctly but the user-input isn´t processed anymore??
Any ideas please?

When you are using the plain Win32 API you can process the WM_ACTIVATE message.

If your are using the MFC you may want to look into CWnd::OnActivate.

Hope that helps.