有个问题请教网上高手:
我在CView类中写了一个设置时钟函数如下:
if(SetTimer(ABC, 30, NULL))
{
int e = GetLastError();
}在函数运行过程中 e 的值为 0 ,但仍能响应OnTimer,不知为何。
我在CView类中写了一个设置时钟函数如下:
if(SetTimer(ABC, 30, NULL))
{
int e = GetLastError();
}在函数运行过程中 e 的值为 0 ,但仍能响应OnTimer,不知为何。
解决方案 »
- MFC中,如何控制另一个程序?大哥们帮帮忙吧!
- 动态创建CbitmapButton的问题
- GetOpenFileName(LPOPENFILENAME lpofn)怎么设置Filter使得可以同时显示多种文件供选择?
- 很简单的问题,凉了几天了,跪求大侠们解答
- 得到嵌套list中数据的问题,急在线等=====分不够再开贴
- 什么情况下需要包含#include <stdlib.h> 和 #include <stdio.h>
- 如何生成一个win32 exe文件?
- 如何把一个二维位图变换为虚拟的三维动画
- Callback如何做成类的成员并访问类中的其他成员?
- 浏览器插件读取特定文件
- Picture控件
- 二维数组传参问题?
既然能看到e的值,自然是定时器创建成功,
必定要出发OnTimer()函数,只有不成功时才使用GetLastError()函数
获取错误信息
Return Values
If the function succeeds, the return value is an integer identifying the new timer. An application can pass this value, or the string identifier, if it exists, to the KillTimer function to destroy the timer. If the function fails to create a timer, the return value is zero. To get extended error information, call GetLastError.它告诉你函数执行失败的时候返回值为0,此时可以调用GetLastError获取错误信息。
if(!SetTimer(ABC, 30, NULL))
{
int e = GetLastError();
}
给分吧