-
-
vc++ MFC程序中SetTimer调用无法通过编译!请指点
-
-
vc++ MFC程序中SetTimer调用无法通过编译!请指点
这个问题首先在头文件作如下定义
#define ANIMAL_ID 1112
然后在check控件事件中关联m_animal
事件代码如下:
void CPAGE_TVSHOW::OnChkAnimal()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
if(m_animal)
{
SetTimer(ANIMAL_ID,10000,(TIMERPROC)&ANIMAL);
}
else
{
KillTimer(ANIMAL_ID);
}
}
这里编译时提示如下错误
PAGE_TVSHOW.cpp
D:\debug c\21day c++\Event notice assistant\PAGE_TVSHOW.cpp(72) : error C2143: syntax error : missing ')' before ';'
D:\debug c\21day c++\Event notice assistant\PAGE_TVSHOW.cpp(72) : error C2660: 'SetTimer' : function does not take 1 parameters
D:\debug c\21day c++\Event notice assistant\PAGE_TVSHOW.cpp(72) : error C2143: syntax error : missing ';' before ','
D:\debug c\21day c++\Event notice assistant\PAGE_TVSHOW.cpp(72) : error C2059: syntax error : ')'
D:\debug c\21day c++\Event notice assistant\PAGE_TVSHOW.cpp(76) : error C2143: syntax error : missing ')' before ';'
D:\debug c\21day c++\Event notice assistant\PAGE_TVSHOW.cpp(76) : error C2059: syntax error : ')'
Error executing cl.exe.
但如果将check控件事件代码改为如下
void CPAGE_TVSHOW::OnChkAnimal()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
if(m_animal)
{
SetTimer(1112,10000,(TIMERPROC)&ANIMAL);
}
else
{
KillTimer(1112);
}
}
就能顺利通过编译执行,请知道所以然的大侠们指点下,谢谢!
[注意]APP应用上架合规检测服务,协助应用顺利上架!