// MyDialogLog.cpp : ʵÏÖÎļþ
|
//
|
|
#include "pch.h"
|
#include "MTerm2.h"
|
#include "MyDialogLog.h"
|
#include "afxdialogex.h"
|
|
|
// CMyDialogLog ¶Ô»°¿ò
|
|
IMPLEMENT_DYNAMIC(CMyDialogLog, CDialogEx)
|
|
CMyDialogLog::CMyDialogLog(CWnd* pParent /*=NULL*/)
|
: CDialogEx(CMyDialogLog::IDD, pParent)
|
{
|
|
}
|
|
CMyDialogLog::~CMyDialogLog()
|
{
|
}
|
|
void CMyDialogLog::DoDataExchange(CDataExchange* pDX)
|
{
|
CDialogEx::DoDataExchange(pDX);
|
// DDX_Control(pDX, IDC_EDIT_LOG, m_MyEditLog1);
|
DDX_Control(pDX, IDC_EDIT_LOG1, m_edit_log1);
|
}
|
|
|
BEGIN_MESSAGE_MAP(CMyDialogLog, CDialogEx)
|
ON_WM_SIZE()
|
ON_WM_CREATE()
|
ON_WM_TIMER()
|
END_MESSAGE_MAP()
|
|
|
// CMyDialogLog ÏûÏ¢´¦Àí³ÌÐò
|
int CMyDialogLog::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
{
|
if (CDialogEx::OnCreate(lpCreateStruct) == -1)
|
return -1;
|
|
// TODO: ÔÚ´ËÌí¼ÓÄúרÓõĴ´½¨´úÂë
|
return 0;
|
}
|
|
|
BOOL CMyDialogLog::OnInitDialog()
|
{
|
CDialogEx::OnInitDialog();
|
|
// TODO: ÔÚ´ËÌí¼Ó¶îÍâµÄ³õʼ»¯
|
CString VersionStr = _T("V1.02");
|
CString BuildStr = _T("20210728");
|
|
myLogger1.SetLogPathName(_T("D:\\Logs\\MTerm2"), _T("MTerm2"));
|
myLogger1.AttachWnd(GetDlgItem(IDC_EDIT_LOG1)->m_hWnd);
|
myLogger1.bShowLog[0] = 1;
|
myLogger1.bShowThreadId = 0;
|
myLogger1.bShowChannel = 0;
|
myLogger1.bSaveLog[0] = 1;
|
myLogger1.bShowDate = 1;
|
|
SysLog(_T(" Start ") + VersionStr + _T(" ") + BuildStr + _T("\r\n"));
|
myLogger1.bShowDate = 0;
|
|
// CString s1;
|
// GetWindowText(s1);
|
// s1.Append(_T(" ") + VersionStr + _T(" ") + BuildStr);
|
// SetWindowText(s1);
|
|
SetTimer(1,100,NULL);
|
return TRUE; // return TRUE unless you set the focus to a control
|
// Òì³£: OCX ÊôÐÔÒ³Ó¦·µ»Ø FALSE
|
}
|
|
void CMyDialogLog::OnTimer(UINT_PTR nIDEvent)
|
{
|
// TODO: ÔÚ´ËÌí¼ÓÏûÏ¢´¦Àí³ÌÐò´úÂëºÍ/»òµ÷ÓÃĬÈÏÖµ
|
if (nIDEvent==1)
|
{
|
KillTimer(1);
|
SetTimer(2,200,NULL);
|
}
|
else if (nIDEvent==2)
|
{
|
myLogger1.UpdateLogDisplay();
|
}
|
else
|
{
|
|
}
|
CDialogEx::OnTimer(nIDEvent);
|
}
|
|
void CMyDialogLog::OnSize(UINT nType, int cx, int cy)
|
{
|
CDialogEx::OnSize(nType, cx, cy);
|
|
// TODO: ÔÚ´Ë´¦Ìí¼ÓÏûÏ¢´¦Àí³ÌÐò´úÂë
|
|
CWnd * pwnd;
|
pwnd=GetDlgItem(IDC_EDIT_LOG1);
|
if (pwnd!=NULL)
|
{
|
// RECT rect1;
|
GetDlgItem(IDC_EDIT_LOG1)->SetWindowPos(NULL,0,0,cx,cy-20,NULL);
|
}
|
pwnd=GetDlgItem(IDC_CHECK_PAUSEUPDATE);
|
if (pwnd!=NULL)
|
{
|
//RECT rect1;
|
CRect rect1;
|
GetDlgItem(IDC_CHECK_PAUSEUPDATE)->GetWindowRect(rect1);
|
ScreenToClient(&rect1);
|
GetDlgItem(IDC_CHECK_PAUSEUPDATE)->SetWindowPos(NULL,4,cy-rect1.Height()-4,rect1.Width(),rect1.Height(),NULL);
|
}
|
pwnd=GetDlgItem(IDC_CHECK_NOSCROLL);
|
if (pwnd!=NULL)
|
{
|
CRect rect1;
|
GetDlgItem(IDC_CHECK_NOSCROLL)->GetWindowRect(rect1);
|
ScreenToClient(&rect1);
|
GetDlgItem(IDC_CHECK_NOSCROLL)->SetWindowPos(NULL,cx-rect1.Width()-4,cy-rect1.Height()-4,rect1.Width(),rect1.Height(),NULL);
|
}
|
}
|
|