You should use Lazarus. It comes with latest version of FPC while dev-Pascal comes with an old one. So there will be no problems with missing headers.

I have managed to compile and run your example. The compilation errors
were cause by the line
Code:
msg : MSG;		// Windows messages
The name of the variable is same as its type, so change it to something diferent. (In all places this variable is used ).

The application window will not show up when run from Lazarus IDE. Why - no idea. But when run from outside of the IDE it works perfectly.