This repository has been archived by the owner on Mar 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTestDialog.cpp
72 lines (55 loc) · 1.79 KB
/
TestDialog.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// TestDialog.cpp : implementation file
//
#include "stdafx.h"
#include "NDBView.h"
#include "TestDialog.h"
// CTestDialog dialog
IMPLEMENT_DYNAMIC(CTestDialog, CDialog)
CTestDialog::CTestDialog(const BREF& bref, CB cb, NDBViewer * pNDBViewer, CWnd* pParent)
: CDialog(CTestDialog::IDD, pParent), m_btc(bref, cb, pNDBViewer), m_cfrc(0, pNDBViewer->GetHeader().root.ibFileEof, pNDBViewer)
{
m_data = new BYTE[(UINT)cb];
m_cbData = (UINT)cb;
pNDBViewer->ReadBlock(m_data, m_cbData, NULL, bref.ib, m_cbData);
pNDBViewer->DecodeBlockInPlace(m_data, m_cbData, bref.bid);
m_ibStart = bref.ib;
m_cfrc.AddRange(bref.ib, bref.ib+cb, TYPE_BLOCK);
}
CTestDialog::~CTestDialog()
{
delete [] m_data;
}
void CTestDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_CUSTOM1, m_btc);
DDX_Control(pDX, IDC_LIST3, m_hexListBox);
DDX_Control(pDX, IDC_CUSTOM2, m_cfrc);
}
BEGIN_MESSAGE_MAP(CTestDialog, CDialog)
ON_BN_CLICKED(IDC_RADIO2, &CTestDialog::OnBnClickedRadio2)
ON_BN_CLICKED(IDC_RADIO1, &CTestDialog::OnBnClickedRadio1)
ON_BN_CLICKED(IDC_RADIO3, &CTestDialog::OnBnClickedRadio3)
END_MESSAGE_MAP()
// CTestDialog message handlers
BOOL CTestDialog::OnInitDialog()
{
CDialog::OnInitDialog();
CheckRadioButton(IDC_RADIO1, IDC_RADIO3, IDC_RADIO1);
m_hexListBox.SetData(m_data, m_cbData, m_ibStart);
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CTestDialog::OnBnClickedRadio2()
{
m_hexListBox.SetMode(MODE_BINARY);
}
void CTestDialog::OnBnClickedRadio1()
{
m_hexListBox.SetMode(MODE_HEX);
}
void CTestDialog::OnBnClickedRadio3()
{
m_hexListBox.SetMode(MODE_UNICODE);
}