Hallo,
I have been working a application which communicates with the micro controller with com interface and send status request and receive the answer every few seconds. I used set timer for the same. When there is a change in status warning message should pop up only once even if the status change still persists in the next packet received. But the warning message is popping up every time the packet is received . The timer flags does not work. Please let me know if i am missing something
void CALLBACK StatusRequest(HWND StatusHwnd, UINT uMsg, UINT timerId, DWORD dwTime){
ret = sendReceivePacket(........);
TIMEFLAG = false ;
if (TIMEFLAG == false)
{
if(ret ==0) // change is status
{
//warning message//
TIMEFLAG = True;
.................
}
else
{
}
}
INT_PTR CALLBACK DlgProc(HWND hDlg, UINT msg, WPARAM wP, LPARAM lP){
switch (msg){
case WM_INITDIALOG:
SetTimer(NULL, TIMER_ID_SEND_REQUEST, 1000 * 3, (TIMERPROC)StatusRequest);
case WM_TIMER:
KillTimer(NULL, TIMER_ID_SEND_REQUEST);
}
}
The DLg proc is the main dialog function with different messages. Timeflag was used to stop the warning message to print everytime but it is not working. Kill timer didnot work as well.