📄 logoutputdlg.cpp
字号:
/*
VIS H.323 Video Conference System
--Sample for VIS H.323 DLL Library 2.1 Release
For more information,visit our homepage
[http://www.115studio.com]
or mail to us for tech support and bug report
[support@115studio.com]
2000-2004 115Studio
2004-04-05
*/
// LogOutputDlg.cpp : implementation file
//
#include "stdafx.h"
#include "visconf.h"
#include "LogOutputDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CLogOutputDlg dialog
CLogOutputDlg::CLogOutputDlg(CWnd* pParent /*=NULL*/)
: CDialog(CLogOutputDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CLogOutputDlg)
m_writeLogToFile = FALSE;
//}}AFX_DATA_INIT
m_brush.CreateSolidBrush(0x00ffffff);
}
void CLogOutputDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CLogOutputDlg)
DDX_Control(pDX, IDC_OUTPUT, m_output);
DDX_Check(pDX, IDC_WRITE_LOG_TO_FILE, m_writeLogToFile);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CLogOutputDlg, CDialog)
//{{AFX_MSG_MAP(CLogOutputDlg)
ON_WM_CTLCOLOR()
ON_WM_SIZE()
ON_WM_CLOSE()
ON_BN_CLICKED(IDC_WRITE_LOG_TO_FILE, OnWriteLogToFile)
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CLogOutputDlg message handlers
BOOL CLogOutputDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
UpdateData(FALSE);
m_output.SetSel(m_output.GetWindowTextLength(),-1);
m_output.ReplaceSel("=>VIS H.323 Library 2.0 log output begin\r\r\n");
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
HBRUSH CLogOutputDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
if(pWnd->m_hWnd==m_output)
{
//Set read-only edit box white background
pDC->SetBkColor(0x00ffffff);
return m_brush;
}
// TODO: Return a different brush if the default is not desired
return hbr;
}
void CLogOutputDlg::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
CRect rc;
m_output.GetWindowRect(&rc);
ScreenToClient(&rc);
rc.right=cx-1;
rc.bottom=cy-1;
m_output.SetWindowPos(NULL,0,0,rc.Width(),rc.Height(),SWP_NOMOVE);
}
void CLogOutputDlg::OnClose()
{
// TODO: Add your message handler code here and/or call default
CWnd *MainWnd=::AfxGetApp()->GetMainWnd();
if(MainWnd)
MainWnd->SendMessage(UM_CHILD_CLOSE,(WPARAM)m_hWnd,0);
}
void CLogOutputDlg::Output(const char *output)
{
CString out;
char t[20];
_strtime(t);
out.Format("[%s] %s\r\r\n",t,output);
m_output.SetSel(m_output.GetWindowTextLength(),-1);
m_output.ReplaceSel(out);
}
void CLogOutputDlg::OnWriteLogToFile()
{
// TODO: Add your control notification handler code here
UpdateData();
}
void CLogOutputDlg::OnDestroy()
{
CDialog::OnDestroy();
// TODO: Add your message handler code here
m_output.SetSel(m_output.GetWindowTextLength(),-1);
m_output.ReplaceSel("=>VIS H.323 Library 2.0 log output end");
if(m_writeLogToFile)
{
CTime t=CTime::GetCurrentTime();
CString FileName;
CString log;
CFile file;
char path[256]="";
GetModuleFileName(NULL,path,256);
for(int i=strlen(path)-1;i>0;i--)
{
if(path[i]=='\\')
{
path[i+1]=0;
break;
}
}
FileName.Format("%s%d-%d-%d_%02d-%02d-%02d.log",path,
t.GetYear(),t.GetMonth(),t.GetDay(),t.GetHour(),t.GetMinute(),t.GetSecond());
if(file.Open( FileName, CFile::modeCreate | CFile::modeWrite ))
{
m_output.GetWindowText(log);
CArchive ar( &file, CArchive::store);
ar.WriteString(log);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -