I have created a plug-in for this. You can download it from my site . Go to the software page and look for the 'compile current' plug-in.
What it essentially does, is copy the contents of the active tab into a new window, compile it and if there a no errors (warnings are ignored), it will close the new window. I you have errors, the new window will stay open in readonly mode.