请问定时器是这么设置的吗,怎么不起作用

来源:百度知道 编辑:UC知道 时间:2024/06/14 14:37:00
void CMyDlg::OnButton1()
{
// TODO: Add your control notification handler code here
FILE *p;
char a;

CString b;

p=fopen("d://1.txt","r+");

m_e1.SetTimer(1,1000,NULL);
OnTimer(1);
{
if(a!=EOF)
{
a=fgetc(p);
b=b+'a';
m_e1.SetWindowText(b);
//Sleep(10);
}
else KillTimer(1);
}
//
fclose(p);

}
只输出第一个字符就停了,谁能帮我修改下,让他起作用!!谢谢。。
那应该写在哪里啊,我不太懂啊,教教我吧。

你的代码不对,应该通过类向导添加定时器的消息处理函数OnTimer(); 时间到了以后会自动执行,而不是自己调用。

OnTimer(1);
{
if(a!=EOF)
{
a=fgetc(p);
b=b+'a';
m_e1.SetWindowText(b);
//Sleep(10);
}
OnTime怎么在这里

你怎么把Ontimer函数写在Button函数里边了