该死的MSDN!谁能帮帮我!(GetMonitorInfo 与 winuser.h)

WM_JAWIN 2005-03-14 10:37:50
我想用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
这为什么呢?各位有什么解决方法?
...全文
341 8 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
WM_JAWIN 2005-03-16
  • 打赏
  • 举报
回复
Freshyy(云淡风清)讲得对。现在可以了。

不过还是有点纳闷!MSDN也没有指明要Win2K以上的系统……

QuickInfo:
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.

WM_JAWIN 2005-03-15
  • 打赏
  • 举报
回复
包不包含也没关系啊。总不可能再Inlcude一次就不行吧.
hihi110 2005-03-15
  • 打赏
  • 举报
回复
winuser.h是包含在windows.h内的。
WM_JAWIN 2005-03-15
  • 打赏
  • 举报
回复
不是吧!我用VB都可以。声明是在user32.dll里。真晕!
老夏Max 2005-03-15
  • 打赏
  • 举报
回复
preliminary documentation -----预备文档,即,可能这个功能还没有实现,呵呵
WM_JAWIN 2005-03-15
  • 打赏
  • 举报
回复
嘿嘿,这是什么意思?俺的英文不好,看来看去都不是个意思.
Freshyy 2005-03-15
  • 打赏
  • 举报
回复
你再看msdn的最后
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
mythay 2005-03-14
  • 打赏
  • 举报
回复
msdn的上方还有一句话
“[This is preliminary documentation and subject to change.] ”
呵呵!

15,473

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 进程/线程/DLL
社区管理员
  • 进程/线程/DLL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧