| | |
| | | |
| | | SetPath(strPath); |
| | | |
| | | // #3417 LYWCF AOI Review 전설비 Log Process개선 ADD START |
| | | DWORD dwThreadId = 0; |
| | | HANDLE hThread = CreateThread(NULL, 0, RunThreadDisplayLog, NULL, 0, &dwThreadId); |
| | | m_ThreadId = dwThreadId; |
| | | // #3417 LYWCF AOI Review 전설비 Log Process개선 ADD END |
| | | |
| | | InitializeCriticalSection(&m_csLog); |
| | | } |
| | | |
| | |
| | | delete m_pFileLog; |
| | | m_pFileLog = NULL; |
| | | } |
| | | |
| | | PostThreadMessage(m_ThreadId, WM_QUIT, 0, 0); |
| | | |
| | | DeleteCriticalSection(&m_csLog); |
| | | } |
| | |
| | | |
| | | return TRUE; |
| | | } |
| | | |
| | | // #3417 LYWCF AOI Review 전설비 Log Process개선 ADD START |
| | | void CDisplayMessage::DisplayMessage(const CString& strMessage) |
| | | { |
| | | WriteToFile(strMessage); |
| | | // WriteToFile(strMessage); |
| | | // |
| | | // if(m_pDM2P) |
| | | // { |
| | | // m_pDM2P->DM2P_DisplayMessage(strMessage); |
| | | // } |
| | | CString* pstrLog = new CString(strMessage); |
| | | PostThreadMessage(m_ThreadId, WM_DIPLAY_LOG, reinterpret_cast<WPARAM>(pstrLog), 0); |
| | | |
| | | if(m_pDM2P) |
| | | { |
| | | m_pDM2P->DM2P_DisplayMessage(strMessage); |
| | | } |
| | | } |
| | | // #3417 LYWCF AOI Review 전설비 Log Process개선 ADD END |
| | | |
| | | // #3417 LYWCF AOI Review 전설비 Log Process개선 ADD START |
| | | void CDisplayMessage::DisplayMessage(const TCHAR* lpstrFormat, ...) |
| | | { |
| | | va_list list; |
| | |
| | | _vstprintf_s(strText, lpstrFormat, list); |
| | | va_end(list); |
| | | |
| | | WriteToFile(strText); |
| | | CString* pstrLog = new CString(strText); |
| | | PostThreadMessage(m_ThreadId, WM_DIPLAY_LOG, reinterpret_cast<WPARAM>(pstrLog), 0); |
| | | |
| | | if(m_pDM2P) |
| | | // WriteToFile(strText); |
| | | // |
| | | // if(m_pDM2P) |
| | | // { |
| | | // m_pDM2P->DM2P_DisplayMessage(strText); |
| | | // } |
| | | } |
| | | // #3417 LYWCF AOI Review 전설비 Log Process개선 ADD END |
| | | |
| | | // #3417 LYWCF AOI Review 전설비 Log Process개선 ADD START |
| | | void CDisplayMessage::ThreadDisplayMessage(const CString& strMessage) |
| | | { |
| | | WriteToFile(strMessage); |
| | | |
| | | if (m_pDM2P) |
| | | { |
| | | m_pDM2P->DM2P_DisplayMessage(strText); |
| | | m_pDM2P->DM2P_DisplayMessage(strMessage); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | if(m_pFileLog == NULL) return FALSE; |
| | | |
| | | EnterCriticalSection(&m_csLog); |
| | | //EnterCriticalSection(&m_csLog); |
| | | |
| | | CTime time = CTime::GetCurrentTime(); |
| | | CString strTimeStamp = _T(""); |
| | |
| | | m_pFileLog->Close(); |
| | | } |
| | | |
| | | LeaveCriticalSection(&m_csLog); |
| | | //LeaveCriticalSection(&m_csLog); |
| | | |
| | | return TRUE; |
| | | } |
| | | |
| | | DWORD RunThreadDisplayLog(LPVOID param) |
| | | { |
| | | MSG msg; |
| | | while (GetMessage(&msg, NULL, 0, 0)) |
| | | { |
| | | CString* pstrLog = reinterpret_cast<CString*>(msg.wParam); |
| | | switch (msg.message) |
| | | { |
| | | case WM_DIPLAY_LOG: |
| | | |
| | | g_pLog->ThreadDisplayMessage(*pstrLog); |
| | | break; |
| | | |
| | | |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | return 0; |
| | | } |
| | | // #3417 LYWCF AOI Review 전설비 Log Process개선 ADD END |