OnTimer function not activated
I'm a student and not very proffessional in programming, but i want to use the OnTimer function. This is working very well in an other class, but in this not. With the debugger i check and the function OnTimer is never activated. But the SetTimer is done (also checked with the debugger)
Maybe you're expert and see the problem in one eye?
Thanks for have a look, Bart
This code is only a test-part, because the problem is around the timer i put away the original code and create a some test code.
I'm using C++ / MFC
CTHREADFUNCTION.h
--------------------
#pragma once
#include "afxmt.h"
#include "SerialCommFunctions.h"
#include "afxwin.h"
class CThreadFunctions : public CDialog
{
protected:
DECLARE_MESSAGE_MAP()
public:
CThreadFunctions(CTCM120LAB *m_pSerialTcmLABTemp, CSerialCommFunctions *m_pSerialCommFunctionsTcmLABTemp, CSerialCommFunctions *m_pSerialCommFunctionsTcmAnalyseTemp);
~CThreadFunctions(void);
void OnTimer(UINT nIDEvent);
void CheckTcmLab();
bool GetTimeOut50ms();
void SetTimeOut50ms(bool bTimeOut50msTemp);
bool bTimeOut50ms;
};
CTHREADFUNCTIONS.cpp
----------------------
#include "StdAfx.h"
#include "threadfunctions.h"
#include <tchar.h>
#include <windows.h>
#include <stdio.h>
#include <string.h>
CThreadFunctions::CThreadFunctions(CTCM120LAB *m_pSerialTcmLABTemp, CSerialCommFunctions *m_pSerialCommFunctionsTcmLABTemp, CSerialCommFunctions *m_pSerialCommFunctionsTcmAnalyseTemp)
{
m_pSerialTcmLAB = m_pSerialTcmLABTemp;
m_pSerialCommFunctionsTcmLAB = m_pSerialCommFunctionsTcmLABTemp;
m_pSerialCommFunctionsTcmAnalyse = m_pSerialCommFunctionsTcmAnalyseTemp;
}
CThreadFunctions::~CThreadFunctions(void)
{
}
BEGIN_MESSAGE_MAP(CThreadFunctions, CDialog)
ON_WM_TIMER()
END_MESSAGE_MAP()
void CThreadFunctions::CheckTcmLab()
{
CString sTemp;
SetTimer(2, 100, 0);
SetTimeOut50ms(false);
while (GetTimeOut50ms() == false)
{}
}
void CThreadFunctions::OnTimer(UINT nIDEvent)
{
switch (nIDEvent)
{
case 2:
{
CThreadFunctions::SetTimeOut50ms = (true);
}
break;
default:
break;
}
CDialog::OnTimer(nIDEvent);
}

