Updated code from http://carnage-melon.tom7.org/embed/ to run on Windows7 64bit