我有一个 c++ 应用程序,我想每 1 分钟调用一次函数。我从一位朋友那里得到了这段代码(感谢他)
void CALLBACK f(HWND hwnd, UINT uMsg, UINT timerId, DWORD dwTime)
{
printf("Hello");
}
int main()
{
MSG msg;
SetTimer(NULL, 0, 1000*60,(TIMERPROC) &f);
while(GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
//Here I have the rest of my appliation
return 0;
}
但我无法在一段时间后执行我的程序的其余部分。所以,我正在寻找一种解决方案来每分钟执行所有代码和函数 f。