Thanks a lot for the help, it works (sort of...)

For the moment I have set it to close the application if they alt+tab, this isn't how I want to leave it, but it's stopped the crashing for the moment.

I seem to have a problem in the logic of my app. My main loop is in the AppOnIdle event, and I think that it may be causing the SetCoop to fail, or hang for a very long time when going back into the application. Spent a few hours trying to work out why it wouldn't go back into fullscreen. I suspect its that main loop that needs to be halted.

Another related question:-

What should I be using WndProc for other than this? Anything else that you would recommend using the message handler for?