?? chm reader.cpp
字號:
/*
ToDo.
1. Back Button??
*/
//
// CHM Reader.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "CHM Reader.h"
#include "MainFrm.h"
#include "CHM ReaderDoc.h"
#include "CHM ReaderView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCHMReaderApp
BEGIN_MESSAGE_MAP(CCHMReaderApp, CWinApp)
//{{AFX_MSG_MAP(CCHMReaderApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCHMReaderApp construction
CCHMReaderApp::CCHMReaderApp() : CWinApp()
{
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CCHMReaderApp object
CCHMReaderApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CCHMReaderApp initialization
BOOL CCHMReaderApp::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.
// Change the registry key under which our settings are stored.
// You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(_T("CHMReader"));
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
CString FileFilter(_T("CHM Files|*.chm"));
CCeDocListDocTemplate* pDocTemplate;
pDocTemplate = new CCeDocListDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CCHMReaderDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CCHMReaderView),FileFilter);
AddDocTemplate(pDocTemplate);
// Registry File Association
CVORegistry Reg(HKEY_CLASSES_ROOT,_T(".chm"),true);
Reg.WriteString(_T(""),_T("CHM.File"));
CVORegistry Reg2(HKEY_CLASSES_ROOT,_T("CHM.File\\DefaultIcon"),true);
Reg2.WriteString(_T(""),_T("Chm Reader.exe,0"));
CVORegistry Reg3(HKEY_CLASSES_ROOT,_T("CHM.File\\Shell\\Open\\Command"),true);
Reg3.WriteString(_T(""),_T("ChmReader.exe \"%1\""));
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
BOOL bResult = ProcessShellCommand(cmdInfo);
if (!bResult)
{
pDocTemplate->ShowDocList();
CCeDocList* pDL = pDocTemplate->m_pWndDocList;
pDL->EnableUpdate();
pDL->GetCommandBar()->m_bShowSharedNewButton = false;
}
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
~CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
CStatic m_Info1;
CStatic m_Info2;
//}}AFX_DATA
CFont* m_pFont1;
CFont* m_pFont2;
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
virtual BOOL OnInitDialog(); // Added for WCE apps
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
m_pFont1=NULL;
m_pFont2=NULL;
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
DDX_Control(pDX, IDC_INFO1, m_Info1);
DDX_Control(pDX, IDC_INFO2, m_Info2);
//}}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 CCHMReaderApp::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
}
/////////////////////////////////////////////////////////////////////////////
// CCHMReaderApp commands
// Added for WCE apps
CAboutDlg::~CAboutDlg()
{
if (m_pFont1)
delete m_pFont1;
m_pFont1=NULL;
if (m_pFont2)
delete m_pFont2;
m_pFont2=NULL;
}
BOOL CAboutDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_pFont1=new CFont;
m_pFont1->CreatePointFont(120,_T("Times New Roman"));
m_Info1.SetFont(m_pFont1,true);
m_pFont2=new CFont;
m_pFont2->CreatePointFont(80,_T("Arial"));
m_Info2.SetFont(m_pFont2,true);
CenterWindow();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -