QuakeGod
2024-12-24 61deef5cdf96cbfdd6ad45be49e80d597c00ca65
提交 | 用户 | age
418cb3 1 // MyFormLog.cpp : 实现文件
Q 2 //
3
4 #include "pch.h"
5 #include "MTerm1.h"
6 #include "MyFormLog.h"
7
8
9 // CMyFormLog
10
11 IMPLEMENT_DYNCREATE(CMyFormLog, CFormView)
12
13 CMyFormLog::CMyFormLog()
14     : CFormView(CMyFormLog::IDD)
15 {
16
17 }
18
19 CMyFormLog::~CMyFormLog()
20 {
21 }
22
23 void CMyFormLog::DoDataExchange(CDataExchange* pDX)
24 {
25     CFormView::DoDataExchange(pDX);
26     DDX_Control(pDX, IDC_EDIT_LOG, m_edit_log);
27     DDX_Control(pDX, IDC_RICHEDIT2_LOG, m_richedit_log);
28 }
29
30 BEGIN_MESSAGE_MAP(CMyFormLog, CFormView)
31     ON_WM_CREATE()
32     ON_WM_DESTROY()
33     ON_WM_SIZE()
34     ON_WM_MOUSEACTIVATE()
35     ON_WM_TIMER()
36 END_MESSAGE_MAP()
37
38
39 // CMyFormLog 诊断
40
41 #ifdef _DEBUG
42 void CMyFormLog::AssertValid() const
43 {
44     CFormView::AssertValid();
45 }
46
47 #ifndef _WIN32_WCE
48 void CMyFormLog::Dump(CDumpContext& dc) const
49 {
50     CFormView::Dump(dc);
51 }
52 #endif
53 #endif //_DEBUG
54
55
56 // CMyFormLog 消息处理程序
57
58
59 BOOL CMyFormLog::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
60 {
61     // TODO: 在此添加专用代码和/或调用基类
62
63     return CFormView::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
64 }
65
66
67 int CMyFormLog::OnCreate(LPCREATESTRUCT lpCreateStruct)
68 {
69     if (CFormView::OnCreate(lpCreateStruct) == -1)
70         return -1;
71
72     // TODO:  在此添加您专用的创建代码
73
74     return 0;
75 }
76
77
78 void CMyFormLog::OnDestroy()
79 {
80     CFormView::OnDestroy();
81
82     // TODO: 在此处添加消息处理程序代码
83 }
84
85
86 void CMyFormLog::OnSize(UINT nType, int cx, int cy)
87 {
88     CFormView::OnSize(nType, cx, cy);
89     // TODO: 在此处添加消息处理程序代码
61deef 90     CString s1;
418cb3 91     CWnd * pwnd;
61deef 92 ///*
418cb3 93     pwnd=GetDlgItem(IDC_EDIT_LOG);
Q 94     if (pwnd!=NULL)
95     {
96 //        RECT    rect1;
97         pwnd->SetWindowPos(NULL,0,0,cx,cy-20,NULL);
61deef 98 //        s1.Format(_T("OnSize %d  %d %d \r\n"), nType, cx, cy);
Q 99         // ((CEdit*)GetDlgItem(IDC_EDIT_LOG))->ReplaceSel(s1);
418cb3 100
61deef 101     }
Q 102 // */
103
104 /*
418cb3 105     pwnd = GetDlgItem(IDC_RICHEDIT2_LOG);
Q 106     if (pwnd != NULL)
107     {
108         //        RECT    rect1;
109         pwnd->SetWindowPos(NULL, 0, 0, cx, cy - 20, NULL);
110     }
111 //*/
112     pwnd=GetDlgItem(IDC_CHECK_PAUSE);
113     if (pwnd!=NULL)
114     {
115         //RECT    rect1;
116         CRect rect1;
117         pwnd->GetWindowRect(rect1);
118         ScreenToClient(&rect1);
119         pwnd->SetWindowPos(NULL,0, cy - rect1.Height()-4,rect1.Width(),rect1.Height(),NULL);
120     }
121     pwnd=GetDlgItem(IDC_CHECK_NOSCROLL);
122     if (pwnd!=NULL)
123     {
124         CRect rect1;
125         pwnd->GetWindowRect(rect1);
126         ScreenToClient(&rect1);
127         pwnd->SetWindowPos(NULL,cx-rect1.Width(),cy-rect1.Height()-4,rect1.Width(),rect1.Height(),NULL);
128     }
129 }
130
131
132 void CMyFormLog::OnInitialUpdate()
133 {
134     CFormView::OnInitialUpdate();
135     CString VersionStr = _T("V1.02");
136     CString BuildStr = _T("20210728");
137     // TODO: 在此添加专用代码和/或调用基类
138     myLogger1.SetLogPathName(_T("D:\\Logs\\MTerm1"), _T("MTerm1"));
61deef 139     myLogger1.AttachWnd(m_edit_log.m_hWnd);
Q 140 //    myLogger1.AttachWnd(m_richedit_log.m_hWnd);
141
418cb3 142     myLogger1.bShowLog[0] = 1;
Q 143     myLogger1.bShowThreadId = 0;
144     myLogger1.bShowChannel = 0;
145     myLogger1.bSaveLog[0] = 1;
146     myLogger1.bShowDate = 1;
147     SysLog(_T(" Start ") + VersionStr + _T(" ") + BuildStr + _T("\r\n"));
148     myLogger1.bShowDate = 0;
149 //    myLogger1.bShowLineCount=0;
150 //    myLogger1.bShowTime=0;
151     myLogger1.UpdateLogDisplay();
152     SetTimer(1, 100, NULL);
153 }
154
155
156 int CMyFormLog::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message)
157 {
158     // TODO: 在此添加消息处理程序代码和/或调用默认值
159
160     return CFormView::OnMouseActivate(pDesktopWnd, nHitTest, message);
161 }
162
163
164 void CMyFormLog::OnTimer(UINT_PTR nIDEvent)
165 {
166     // TODO: 在此添加消息处理程序代码和/或调用默认值
167     if (nIDEvent == 1)
168     {
169         KillTimer(1);
170         SetTimer(2, 200, NULL);
171     }
172     else if (nIDEvent == 2)
173     {
174         myLogger1.UpdateLogDisplay();
175     }
176     else
177     {
178
179     }
180     CFormView::OnTimer(nIDEvent);
181 }