I work on VC++ 2008 in a console application. I want to call a function every x seconds. I have a piece of code but the problem is that the code behind the setTimer does not execute. I am looking something like a simultaneous timer or thread, but as my c++ version is old I cant include thread or chrono. Can anyone help me? Thanks in advance.
The code is here:
void CALLBACK f(HWND hwnd, UINT uMsg, UINT timerId, DWORD dwTime){cout <<"Hello";}
int _tmain(){
MSG msg;
SetTimer(NULL, 0, 100*60,(TIMERPROC) &f);
while(GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
//more code to be execute, but it does not.
return 0;}
This question has been marked as a duplicate, but the problem is not that the message is not shown, that is correct. The problem is to create a timer and run the program simultaneously.