22 Star 28 Fork 8

红薯/Apache Log Analyzer

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
ApacheLogAnalyzer.cpp 5.13 KB
一键复制 编辑 原始数据 按行查看 历史
Winter Lau 提交于 2015-11-09 17:13 +08:00 . init
// ApacheLogAnalyzer.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "ApacheLogAnalyzer.h"
#include "MainFrm.h"
#include "ApacheLogAnalyzerDoc.h"
#include "ApacheLogAnalyzerView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CLogAnalyzerApp
BEGIN_MESSAGE_MAP(CLogAnalyzerApp, CWinApp)
//{{AFX_MSG_MAP(CLogAnalyzerApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
ON_COMMAND(ID_FILE_OPEN, OnFileOpen)
//}}AFX_MSG_MAP
// Standard file based document commands
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
// Standard print setup command
ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CLogAnalyzerApp construction
CLogAnalyzerApp::CLogAnalyzerApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CLogAnalyzerApp object
CLogAnalyzerApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CLogAnalyzerApp initialization
BOOL CLogAnalyzerApp::InitInstance()
{
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
// Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(_T("ApacheLogAnalyzer"));
LoadStdProfileSettings(5); // Load standard INI file options (including MRU)
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CLogAnalyzerDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CLogAnalyzerView));
AddDocTemplate(pDocTemplate);
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// The one and only window has been initialized, so show and update it.
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
// No message handlers
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// App command to run the dialog
void CLogAnalyzerApp::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
}
/////////////////////////////////////////////////////////////////////////////
// CLogAnalyzerApp message handlers
void CLogAnalyzerApp::OnFileOpen()
{
ASSERT(m_pDocManager != NULL);
// prompt the user (with all document templates)
CString newName;
char filters[] = "日志文件(*.log)|*.log|文本文件(*.txt)|*.txt|所有文件(*.*)|*.*||";
CFileDialog dlgFile(TRUE,0,0,OFN_FILEMUSTEXIST | OFN_HIDEREADONLY,filters,NULL);
int structsize = 0;
DWORD dwVersion,dwWindowsMajorVersion,dwWindowsMinorVersion;
dwVersion = GetVersion();
dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
dwWindowsMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));
if(dwVersion < 0x80000000)
structsize = 88;
else
structsize = 76;
dlgFile.m_ofn.lStructSize = structsize;
CString title;
VERIFY(title.LoadString(AFX_IDS_OPENFILE));
dlgFile.m_ofn.lpstrTitle = title;
dlgFile.m_ofn.lpstrFile = newName.GetBuffer(_MAX_PATH);
int nResult = dlgFile.DoModal();
newName.ReleaseBuffer();
if(nResult != IDOK)
return; // open cancelled
AfxGetApp()->OpenDocumentFile(newName);
// if returns NULL, the user has already been alerted
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/ld/Apache-Log-Analyzer.git
git@gitee.com:ld/Apache-Log-Analyzer.git
ld
Apache-Log-Analyzer
Apache Log Analyzer
master

搜索帮助