vc6.0 mfc一些函数明明调用语法正确,但是提示函数或者函数参数未定义等问题解决方法。

本文解决使用VC6.0 MFC编程时遇到的函数参数未定义问题,通过调整预处理宏定义WINVER的值来确保API函数EnumDisplayMonitors的正确调用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

使用vc6.0 mfc 编写程序时一些函数在正常声明、调用的情况下提示函数参数未定义等问题时

如调用EnumDisplayMonitors()会提示下面问题

运行后,出现以下问题:
Compiling...
DDialogDlg.cpp
F:\PG\test_vc6\DDialog\DDialogDlg.cpp(19) : error C2065: 'HMONITOR' : undeclared identifier
F:\PG\test_vc6\DDialog\DDialogDlg.cpp(19) : error C2146: syntax error : missing ')' before identifier 'hMonitor'
F:\PG\test_vc6\DDialog\DDialogDlg.cpp(19) : warning C4229: anachronism used : modifiers on data are ignored
F:\PG\test_vc6\DDialog\DDialogDlg.cpp(19) : error C2059: syntax error : ')'
F:\PG\test_vc6\DDialog\DDialogDlg.cpp(97) : error C2146: syntax error : missing ')' before identifier 'hMonitor'
F:\PG\test_vc6\DDialog\DDialogDlg.cpp(97) : warning C4229: anachronism used : modifiers on data are ignored
F:\PG\test_vc6\DDialog\DDialogDlg.cpp(97) : error C2086: 'MonitorEnumProc' : redefinition
F:\PG\test_vc6\DDialog\DDialogDlg.cpp(97) : error C2059: syntax error : ')'
F:\PG\test_vc6\DDialog\DDialogDlg.cpp(98) : error C2143: syntax error : missing ';' before '{'
F:\PG\test_vc6\DDialog\DDialogDlg.cpp(98) : error C2447: missing function header (old-style formal list?)
F:\PG\test_vc6\DDialog\DDialogDlg.cpp(162) : error C2065: 'EnumDisplayMonitors' : undeclared identifier

 

这时,在stdafx.h 中定义  #define WINVER 0x0500    只要WINVER的值>=0x500就行,因为

WINVER>=0X500 指 Win2000 以上。有些 api 或 常数 只有在Win2000以上才支持

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值