| 发表于:2007-07-24 18:26:43 楼主 |
在第一个程序中我调用了settimer这个函数,设想是每过5秒钟到了之后执行timerproc函数,但是函数timerproc还没有执行,整个程序就结束了,没有结果输出。 #include "windows.h " #include "iostream.h " void callback timerproc(hwnd hwnd,uint umsg,uint idevent,dword dwtime); void main() { settimer(null,1,5000,timerproc); } void callback timerproc(hwnd hwnd,uint umsg,uint idevent,dword dwtime) { cout < < "hello " < <endl; } 在这个程序中,我只是在settimer的后面加上一个死循环,目的就是为了不是函数过早地结束,但是程序一直运行在死循环这,没有我想要的每隔5秒钟发一个hello!. #include "windows.h " #include "iostream.h " void callback timerproc(hwnd hwnd,uint umsg,uint idevent,dword dwtime); void main() { settimer(null,1,5000,timerproc); while(1) {}; } void callback timerproc(hwnd hwnd,uint umsg,uint idevent,dword dwtime) { cout < < "hello! " < <endl; } 那位高手能帮我解答,十分感谢 |
|
|
|
|