That's because preprocessors are stupid. When a preprocessor finds GetObject, it replaces it with GetObjectA or GetObjectW, depending whether you compile a Unicode version or not. Just put something like #undef GetObject after #include <windows.h> and everything should work fine.