Choosedbdlg.cpp
3.3 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
// Choosedbdlg.cpp : implementation file
//
#include "stdafx.h"
#include "sn writer.h"
#include "Choosedbdlg.h"
#include "Common.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern META_Common_struct g_sMetaComm;
/////////////////////////////////////////////////////////////////////////////
// CChoosedbdlg dialog
CChoosedbdlg::CChoosedbdlg(CWnd* pParent /*=NULL*/)
: CDialog(CChoosedbdlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CChoosedbdlg)
my_str_ap_path = _T("");
my_str_bp_path = _T("");
myversion = _T("");
//}}AFX_DATA_INIT
}
void CChoosedbdlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CChoosedbdlg)
DDX_Text(pDX, IDC_EDIT1, my_str_ap_path);
DDX_Text(pDX, IDC_EDIT2, my_str_bp_path);
DDX_Text(pDX, IDC_EDT_VERSION, myversion);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CChoosedbdlg, CDialog)
//{{AFX_MSG_MAP(CChoosedbdlg)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_BN_CLICKED(IDC_BUTTON4, OnButton4)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CChoosedbdlg message handlers
void CChoosedbdlg::OnButton1()
{
char szFilter[]="Database files(*.*)|*.*";
CFileDialog dlg(TRUE, NULL, NULL,
OFN_FILEMUSTEXIST|OFN_EXPLORER|OFN_ENABLESIZING|0x10000000/*OFN_FORCESHOWHIDDEN*/,
szFilter, this);
dlg.m_ofn.lpstrTitle = _T("Select Modem_1 database file...");
if(dlg.DoModal() == IDOK)
{
g_sMetaComm.sDBFileOption.bDBInitModem_1 = false;
my_str_ap_path = dlg.GetPathName();
}
UpdateData(FALSE);
strcpy(g_sMetaComm.sDBFileOption.strAPDbpath,my_str_ap_path.GetBuffer(my_str_ap_path.GetLength()));
}
void CChoosedbdlg::OnButton4()
{
char szFilter[]="Database files(*.*)|*.*";
CFileDialog dlg(TRUE, NULL, NULL,
OFN_FILEMUSTEXIST|OFN_EXPLORER|OFN_ENABLESIZING|0x10000000/*OFN_FORCESHOWHIDDEN*/,
szFilter, this);
dlg.m_ofn.lpstrTitle = _T("Select Modem_1 database file...");
if(dlg.DoModal() == IDOK)
{
g_sMetaComm.sDBFileOption.bDBInitModem_1 = false;
my_str_bp_path = dlg.GetPathName();
}
UpdateData(FALSE);
strcpy(g_sMetaComm.sDBFileOption.strMD1Dbpath,my_str_bp_path.GetBuffer(my_str_bp_path.GetLength()));
}
BOOL CChoosedbdlg::OnInitDialog()
{
CDialog::OnInitDialog();
my_str_ap_path = CString(g_sMetaComm.sDBFileOption.strAPDbpath);
my_str_bp_path = CString(g_sMetaComm.sDBFileOption.strMD1Dbpath);
SetDlgItemText(IDC_STR_AP_PATH,my_str_ap_path);
SetDlgItemText(IDC_STR_BP_PATH,my_str_bp_path);
//
myversion = CString(g_sMetaComm.check_sw_ver);
GetDlgItem(IDC_EDT_VERSION)->SetWindowText(myversion);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CChoosedbdlg::OnOK()
{
UpdateData(TRUE);
// TODO: Add your control notification handler code here
// OnSelchangeComboTargetType();
if (my_str_ap_path== "" ||my_str_bp_path== "")
{
MessageBox("请指定DB文件");
return;
}
if (myversion == "")
{
MessageBox("请输入版本号");
}
memset(g_sMetaComm.check_sw_ver,0x0,sizeof(g_sMetaComm.check_sw_ver));
memcpy(g_sMetaComm.check_sw_ver,myversion.GetBuffer(myversion.GetLength()),myversion.GetLength());
SaveParaToSetupFile();
CDialog::OnOK();
}