Ongoing80 #3417 CF AOI Review 전설비 Log Process개선
- LOG 뷰어 리스트 박스로 변경
- 시퀀스 쓰레드에서 로그 발생기 로그 쓰레드로 메시지로 전송 후 바로 다음 업무 처리
| | |
| | | |
| | | 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 |
| | |
| | | |
| | | #include "CHEdgeTriangle/Singleton.h" |
| | | |
| | | #define WM_DIPLAY_LOG WM_USER + 1000 |
| | | |
| | | interface IDisplayMessage2Parent |
| | | { |
| | | public: |
| | | virtual void DM2P_DisplayMessage(const CString& strMessage) = 0; |
| | | virtual void DM2P_DisplayMessage(const TCHAR* lpstrFormat, ...) = 0; |
| | | }; |
| | | |
| | | DWORD RunThreadDisplayLog(LPVOID param); |
| | | |
| | | class CDisplayMessage : public Singleton<CDisplayMessage> |
| | | { |
| | |
| | | BOOL WriteToFile(const CString& strMessage); |
| | | void DisplayMessage(const CString& strMessage); |
| | | void DisplayMessage(const TCHAR* lpstrFormat, ...); |
| | | void ThreadDisplayMessage(const CString & strMessage); |
| | | |
| | | public: |
| | | CTime m_TimeLogFile; |
| | |
| | | CString m_strLogFile; |
| | | IDisplayMessage2Parent* m_pDM2P; |
| | | CRITICAL_SECTION m_csLog; |
| | | DWORD m_ThreadId; |
| | | }; |
| | | |
| | | #define g_pLog CDisplayMessage::GetSingletonPtr() |
| | |
| | | void CDlgLog::DoDataExchange(CDataExchange* pDX) |
| | | { |
| | | CDialog::DoDataExchange(pDX); |
| | | DDX_Control(pDX, IDC_LIST_LOG, m_ctrlLogListBox); |
| | | DDX_Control(pDX, IDC_LIST_LOG, m_ctrlLogList); |
| | | } |
| | | |
| | | BOOL CDlgLog::OnInitDialog() |
| | | { |
| | | CDialog::OnInitDialog(); |
| | | |
| | | // TODO: 여기에 추가 초기화 작업을 추가합니다. |
| | | m_ctrlLogList.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES); |
| | | m_ctrlLogList.InsertColumn(0, _T("시간"), LVCFMT_CENTER, 150); |
| | | m_ctrlLogList.InsertColumn(1, _T("내용"), LVCFMT_LEFT, 690); |
| | | |
| | | return TRUE; // return TRUE unless you set the focus to a control |
| | | // 예외: OCX 속성 페이지는 FALSE를 반환해야 합니다. |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | CDialog::OnSize(nType, cx, cy); |
| | | |
| | | if (m_ctrlLogListBox.GetSafeHwnd()) |
| | | if (m_ctrlLogList.GetSafeHwnd()) |
| | | { |
| | | m_ctrlLogListBox.SetWindowPos(NULL, 0, 0, cx, cy, SWP_NOZORDER); |
| | | m_ctrlLogList.SetWindowPos(NULL, 0, 0, cx, cy, SWP_NOZORDER); |
| | | } |
| | | |
| | | // TODO: 여기에 메시지 처리기 코드를 추가합니다. |
| | |
| | | |
| | | void CDlgLog::DisplayMessage(const CString& strMessage) |
| | | { |
| | | int nCount; |
| | | CTime time; |
| | | CString strStamp, strLog; |
| | | CString strStamp; |
| | | |
| | | nCount = m_ctrlLogListBox.GetCount(); |
| | | if (m_ctrlLogList.GetItemCount() > 100) |
| | | m_ctrlLogList.DeleteItem(0); |
| | | |
| | | if (nCount % MAX_PRINT_COUNT == 0) |
| | | { |
| | | m_ctrlLogListBox.ResetContent(); |
| | | } |
| | | //if (nCount % MAX_PRINT_COUNT == 0) |
| | | //{ |
| | | // m_ctrlLogList.ResetContent(); |
| | | //} |
| | | |
| | | SYSTEMTIME currentTime; |
| | | ::GetLocalTime(¤tTime); |
| | | time = CTime::GetCurrentTime(); |
| | | strStamp.Format(_T("[%02d:%02d:%02d]"), time.GetHour(), time.GetMinute(), time.GetSecond()); |
| | | strLog.Format(_T("%s %s"), strStamp, strMessage); |
| | | m_ctrlLogListBox.AddString(strLog); |
| | | m_ctrlLogListBox.SetCurSel(m_ctrlLogListBox.GetCount()-1); |
| | | } |
| | | strStamp.Format(_T("[%02d:%02d:%02d:%02d:%02d:%02d]"), time.GetYear(), time.GetMonth(), time.GetDay(), time.GetHour(), time.GetMinute(), time.GetSecond()); |
| | | |
| | | int nRow = m_ctrlLogList.InsertItem(m_ctrlLogList.GetItemCount(), strStamp); |
| | | m_ctrlLogList.SetItemText(nRow, 1, strMessage); |
| | | m_ctrlLogList.EnsureVisible(nRow, FALSE); |
| | | } |
| | |
| | | |
| | | protected: |
| | | virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 지원입니다. |
| | | virtual BOOL OnInitDialog(); |
| | | |
| | | DECLARE_MESSAGE_MAP() |
| | | public: |
| | |
| | | afx_msg void OnSize(UINT nType, int cx, int cy); |
| | | |
| | | protected: |
| | | CListBox m_ctrlLogListBox; |
| | | CListCtrl m_ctrlLogList; |
| | | |
| | | }; |
| | |
| | | STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD |
| | | FONT 9, "MS Shell Dlg", 0, 0, 0x0 |
| | | BEGIN |
| | | LISTBOX IDC_LIST_LOG,5,5,48,32,LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_VSCROLL | WS_TABSTOP |
| | | CONTROL "",IDC_LIST_LOG,"SysListView32",LVS_REPORT | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,5,5,60,50 |
| | | END |
| | | |
| | | IDD_DLG_DEFECT_FILTER DIALOGEX 0, 0, 366, 409 |
| | |
| | | 0 |
| | | END |
| | | |
| | | IDD_DLG_TAB_LOG AFX_DIALOG_LAYOUT |
| | | BEGIN |
| | | 0 |
| | | END |
| | | |
| | | |
| | | ///////////////////////////////////////////////////////////////////////////// |
| | | // |
| | |
| | | #define IDC_EDIT_REVIEW_PANEL_POS_Y4 1109 |
| | | #define IDC_BT_CAMERA_GRAB 1109 |
| | | #define IDC_BUTTION_TARGET_POS 1109 |
| | | //#define IDC_BUTTON_PROGRAMEXIT 1109 |
| | | #define IDC_GRID_ALIGN_INFO 1110 |
| | | #define IDC_EDIT_UPDATE_NOTE 1110 |
| | | #define IDC_BUTTON4 1110 |
| | |
| | | // |
| | | #ifdef APSTUDIO_INVOKED |
| | | #ifndef APSTUDIO_READONLY_SYMBOLS |
| | | #define _APS_NEXT_RESOURCE_VALUE 380 |
| | | #define _APS_NEXT_RESOURCE_VALUE 381 |
| | | #define _APS_NEXT_COMMAND_VALUE 32775 |
| | | #define _APS_NEXT_CONTROL_VALUE 1175 |
| | | #define _APS_NEXT_SYMED_VALUE 346 |