我想用GetMonitorInfo()函数,查MSDN时说在"Header: Declared in winuser.h."
于是就
#include "stdio.h"
#include "iostream.h"
#include "windows.h"
#include "winuser.h"
理论上说时没错的了,可时Complie时就来
error C2065: 'GetMonitorInfo' : undeclared identifier
我晕~
后来在加上#include <multimon.h> Complie时通过。
可时Buile时有来一个
error LNK2001: unresolved external symbol _xGetMonitorInfo@8
这为什么呢?各位有什么解决方法?
于是就
#include "stdio.h"
#include "iostream.h"
#include "windows.h"
#include "winuser.h"
理论上说时没错的了,可时Complie时就来
error C2065: 'GetMonitorInfo' : undeclared identifier
我晕~
后来在加上#include <multimon.h> Complie时通过。
可时Buile时有来一个
error LNK2001: unresolved external symbol _xGetMonitorInfo@8
这为什么呢?各位有什么解决方法?
“[This is preliminary documentation and subject to change.] ”
呵呵!
QuickInfo
Windows NT: Requires version 5.0 or later.而你的版本不满足,事实上,在winuser.h中关于GetMonitorInfo的定义也是在
#if(WINVER >= 0x0500)
WINUSERAPI BOOL WINAPI GetMonitorInfoA(HMONITOR hMonitor, LPMONITORINFO lpmi);
WINUSERAPI BOOL WINAPI GetMonitorInfoW(HMONITOR hMonitor, LPMONITORINFO lpmi);
#endif的条件编译的。
所以要想用这个函数,只需在stdafx.h中定义
#define WINVER 0x0500 即可
或者在settings中设置预编译条件:
WINVER = 0x0500
Windows NT: Requires version 5.0 or later.
Windows: Requires Windows 98.
Windows CE: Unsupported.
Header: Declared in winuser.h.
Import Library: Use user32.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT.