如题,创建了一个AutoShutDown的基本对话框工程,在void CAutoShutDownDlg::OnTimer(UINT nIDEvent)里调用timeGetTime()不成功,错误描述如下:undeclared identifier,不知为何?如果说没有包含某个头文件,那又应该是哪个呢? 另外,我想CAutoShutDown.h里封装一个自动关机的类,但是一开始调用SetTimer的时候就错了,从参数列表来看,是调用了MFC的SetTimer函数了。
//CAutoShutDown.hclass CAutoShutDown{
public:
AutoShutDown(int nTime);
};CAutoShutDown::AutoShutDown(int nTime){
int ret=SetTimer(1,500,NULL);
if(ret==0){
MessageBox("Can't set timer!");
}
}请各位高人帮忙解决问题,谢谢。
新人,分数不多,请见谅。
//CAutoShutDown.hclass CAutoShutDown{
public:
AutoShutDown(int nTime);
};CAutoShutDown::AutoShutDown(int nTime){
int ret=SetTimer(1,500,NULL);
if(ret==0){
MessageBox("Can't set timer!");
}
}请各位高人帮忙解决问题,谢谢。
新人,分数不多,请见谅。
Header: Declared in mmsystem.h.(包含的头文件)
Import Library: Use winmm.lib.(连接的静态库)
DWORD timeGetTime(VOID);
Requirements
Windows NT/2000: Requires Windows NT 3.1 or later.
Windows 95/98: Requires Windows 95 or later.
Header: Declared in Mmsystem.h.
Library: Use Winmm.lib.建议自己学会查资料。如果你的CAutoShutDown是从CWnd继承的,调用的是CWnd::SetTimer();
要用全局函数:::SetTimer();
#include "mmsystem.h"
#pragma comment(lib,"Winmm.lib")
但还是有点不明白,#pragma comment(lib,"Winmm.lib"),这句是不是把Winmm.lib编译在程序里?照MSDN的说法,只是在程序里加注释而已...另外,我的CAutoShutDown不是从任何类继承的呢?SetTimer不是一个标准的C++函数吗?
Header: Declared in winuser.h.
Import Library: Use user32.lib.请问各位大侠,事实上是不是这样的?