If you open up any Win32 application in a Hex editor (or even a text editor such as notepad), you will see this in the first few lines. This is because it is coded into every Win32 program to deal with the same application structure as DOS. If there is no Windows environment present, it simply displays the message, and exits.

Try it:
Drag notepad.exe onto notepad. You should see it quite easily.