settimer在win32 application中使用的问题
如下这个程序并没有弹出我所期望的test消息框,
据说是因为settimer只能在有窗口的程序中使用,不知
这种说法对不对?还是我这个小程序本身有问题?// testoftimer2.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
# include "windows.h"
# include "winuser.h"
# include "winbase.h"
VOID CALLBACK test(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime)
{
MessageBox(NULL,"test","test",MB_OK);
}
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
MessageBox(NULL,"main","main",MB_OK);
UINT ret;
ret=::SetTimer(
NULL, // handle of window for timer messages
0, // timer identifier
1000, // time-out value
test // address of timer procedure
);
Sleep(100);
return 0;
}