近日在做项目时需要使用到 GetLastInputInfo 函数,添加了 #include <windows.h> 头文件,写了代码,编译时报出下列错误:
D:CODEdeldel.cpp(21) : error C2065:'LASTINPUTINFO' : undeclared identifier
D:CODEdeldel.cpp(23) : error C2065: 'GetLastInputInfo' : undeclared identifier
各种解决后,在网上看到一个解决方法,网址如下:
http://forums.codeguru.com/showthread.php?253474-Why-i-cant-compile-code-that-uses-GetLastInputInfo
解决方法:
添加预定义宏 _WIN32_WINNT=0x0500