LAPTOP-SNT8I5JK\Boounion
2024-11-13 5471abe440f1b449293a3c93b3a638396682617a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#if !defined(AFX_BLLISTBOXLOG_H__60501A52_5401_435F_996E_F3EABB095333__INCLUDED_)
#define AFX_BLLISTBOXLOG_H__60501A52_5401_435F_996E_F3EABB095333__INCLUDED_
 
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// cBLListBoxLog.h : header file
//
 
#include "BLFolderScheduling.h"
 
/////////////////////////////////////////////////////////////////////////////
// CBLListBoxLog window
 
#define LOG_NORMAL        1
#define LOG_HISTORY        2
#define LOG_WARNING        3
#define LOG_ERROR        4
#define LOG_DEBUG        5
 
#define STRINGBUFFER_COUNT        200
class AFX_EXT_CLASS CBLListBoxLog : public CListBox
{
// Construction
public:
    CBLListBoxLog();
    virtual ~CBLListBoxLog();
 
// Attributes
public:
 
// Operations
public:
 
// Overrides
    // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(CBLListBoxLog)
    //}}AFX_VIRTUAL
 
    //////////////////////////////////////////////////////////////////////////
    // Logging
    void    SetPath(CString& strPath, CString& strName, BOOL bDelete, int nRemainCount);
    void    DisplayMessages(BOOL bAddMsgBox, int nLevel, TCHAR *str, ...);
    void    DisplayMessages(BOOL bAddMsgBox, TCHAR *str, ...);
    void    DisplayMessage(BOOL bAddMsgBox, int nLevel, TCHAR *str);
    void    DisplayMessage(BOOL bAddMsgBox, TCHAR *str);
    void    SetTextColor(long clbg1 = RGB(255,255,255), long clbg2 = RGB(255,255,255), long clText = RGB(0,0,0));
    virtual void DrawItem(LPDRAWITEMSTRUCT lpDIS);
    // Generated message map functions
protected:
    //{{AFX_MSG(CBLListBoxLog)
    afx_msg LRESULT OnDisplayMessage(WPARAM wParam, LPARAM lParam);
    afx_msg BOOL OnEraseBkgnd(CDC* pDC);
    //}}AFX_MSG
 
    DECLARE_MESSAGE_MAP()
 
    //////////////////////////////////////////////////////////////////////////
    // Folder Management
    CBLFolderScheduling    m_FolderSchedule;
        
    //////////////////////////////////////////////////////////////////////////
    // Logging
    CString                m_strLogDir;
    CString                m_strFileName;
 
    CString                m_strLogPath;
    CString                m_strLogFile;
    CTime                m_TimeLogFile;
    CFile*                m_pFileLog;
 
    TCHAR                m_strBuffer[512];
 
    BOOL                MakeLogFile();
    BOOL                WriteToFile(CTime& time, CString& strContents);
    BOOL                WriteToFile(CTime& time, TCHAR* strContents);
 
    DWORD                m_dwThreadID;
 
    CString                m_strArray[STRINGBUFFER_COUNT];
    BOOL                m_bMustDisplay[STRINGBUFFER_COUNT];
    int                    m_nAddIndex;
    int                    m_nReadIndex;
    CRITICAL_SECTION    m_csLog;
 
    long                m_clBG1;
    long                m_clBG2;
    long                m_clText;
};
 
/////////////////////////////////////////////////////////////////////////////
 
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
 
#endif // !defined(AFX_BLLISTBOXLOG_H__60501A52_5401_435F_996E_F3EABB095333__INCLUDED_)