e0413dlg.cpp
来自「Visualc++6.0自学手册第4章」· C++ 代码 · 共 201 行
CPP
201 行
// E0413Dlg.cpp : implementation file
//
#include "stdafx.h"
#include "E0413.h"
#include "E0413Dlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// 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)
//}}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()
/////////////////////////////////////////////////////////////////////////////
// CE0413Dlg dialog
CE0413Dlg::CE0413Dlg(CWnd* pParent /*=NULL*/)
: CDialog(CE0413Dlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CE0413Dlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CE0413Dlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CE0413Dlg)
DDX_Control(pDX, IDC_TREE1, m_trContent);
DDX_Control(pDX, IDC_TAB1, m_tab);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CE0413Dlg, CDialog)
//{{AFX_MSG_MAP(CE0413Dlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_NOTIFY(TCN_SELCHANGE, IDC_TAB1, OnSelchangeTab1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CE0413Dlg message handlers
BOOL CE0413Dlg::OnInitDialog()
{
CDialog::OnInitDialog();
CRect rect;
GetClientRect(&rect); // 获取对话框客户区
m_tab.MoveWindow(rect); // 设置选项卡显示区域
CImageList * pImgList = new CImageList; // 新建CImageList类对象
pImgList->Create(IDB_BITMAP1, 16, 2, RGB(255,255,255)); // 从资源载入位图
m_tab.SetImageList(pImgList); // 设置选项卡的图像列表
m_tab.InsertItem(0, "图书简介", 0); // 插入选项卡标签
m_tab.InsertItem(1, "图书目录", 1);
HTREEITEM hItem = m_trContent.InsertItem("目 录");
HTREEITEM hItem1, hItem2;
hItem1 = m_trContent.InsertItem("第1章 壳的基础知识", hItem);
hItem2 = m_trContent.InsertItem("1.1 壳的概念、目的和作用", hItem1);
m_trContent.InsertItem("1.1.1 壳的概念", hItem2);
m_trContent.InsertItem("1.1.2 加壳的目的和作用", hItem2);
hItem2 = m_trContent.InsertItem("1.2 常用加壳软件及使用方法", hItem1);
m_trContent.InsertItem("1.2.1 ASPack", hItem2);
m_trContent.InsertItem("1.2.2 UPX", hItem2);
m_trContent.InsertItem("1.2.3 PECompact", hItem2);
m_trContent.InsertItem("1.2.4 其他", hItem2);
hItem2 = m_trContent.InsertItem("1.3 常用侦壳软件及使用方法", hItem1);
m_trContent.InsertItem("1.3.1 Language 2000", hItem2);
m_trContent.InsertItem("1.3.2 FileInfo", hItem2);
m_trContent.InsertItem("1.3.3 PEiDentifier", hItem2);
m_trContent.InsertItem("1.3.4 其他软件", hItem2);
hItem1 = m_trContent.InsertItem("第2章 脱壳", hItem);
hItem2 = m_trContent.InsertItem("2.1 常用脱壳软件及分类", hItem1);
hItem2 = m_trContent.InsertItem("2.2 专用脱壳软件及使用方法", hItem1);
m_trContent.InsertItem("2.2.1 脱ASPack壳软件", hItem2);
m_trContent.InsertItem("2.2.2 脱UPX壳软件", hItem2);
m_trContent.InsertItem("2.2.3 脱PECompact壳软件", hItem2);
hItem2 = m_trContent.InsertItem("2.3 通用脱壳软件及使用方法", hItem1);
m_trContent.InsertItem("2.3.1 ProcDump", hItem2);
m_trContent.InsertItem("2.3.2 GUW32", hItem2);
m_trContent.InsertItem("2.3.3 UN-PACK", hItem2);
return TRUE;
}
void CE0413Dlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CE0413Dlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CE0413Dlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CE0413Dlg::OnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult)
{
int nTab = m_tab.GetCurSel();
if (nTab==0)
{
GetDlgItem(IDC_STATIC1)->ShowWindow(SW_SHOW);
GetDlgItem(IDC_TREE1)->ShowWindow(SW_HIDE);
}
else
{
GetDlgItem(IDC_STATIC1)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_TREE1)->ShowWindow(SW_SHOW);
}
*pResult = 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?