This can't be right: #ifndef __cplus_plus /* this will be the wrong size in c++ */ KEY_EVENT_RECORD KeyEvent; #endif ( somewhere around line 126 ) at the very least that should be __cplusplus, not __cplus_plus.