#include "stdafx.h" #define IDT_TIMER1 100 void CALLBACK TimerProc ( HWND hwnd, UINT message, UINT iTimerID, DWORD dwTime); BOOL bContinue = TRUE; int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { // TODO: Place code here. SetTimer(NULL,IDT_TIMER1,1000,TimerProc); MSG msg; while (1) { GetMessage(&msg, NULL, 0, 0); DispatchMessage(&msg); } return 0; } //处理WM_TIMER讯息 void CALLBACK TimerProc ( HWND hwnd, UINT message, UINT iTimerID, DWORD dwTime) { MessageBox(NULL,"Timer 0",NULL,MB_OK); KillTimer(NULL,IDT_TIMER1); }
无窗口 定时器使用
最新推荐文章于 2023-03-07 16:29:39 发布