#include "stdafx.h"
#include "ipu.h"

void IPU::updateLog(void*)
{
	IPU::getInstance().m_logThreadActive=true;
	for(;IPU::getInstance().m_logThreadExitSign==false;)
	{
		if(0<IPU::getInstance().m_logString.str().size())
		{
			AutoCS(&IPU::getInstance().m_csLog);

			if(IsWindow(IPU::getInstance().m_hLog))
			{
				SendMessage(IPU::getInstance().m_hLog,EM_SETSEL,-2,-1);
				SendMessage(IPU::getInstance().m_hLog,EM_REPLACESEL,FALSE,(LPARAM)IPU::getInstance().m_logString.str().c_str());
				IPU::getInstance().m_logString.str(L"");
			}
		}

		Sleep(1000);

	}

	IPU::getInstance().m_logThreadActive=false;
}
