📄 dialdlg.cpp
字号:
// DialDlg.cpp : implementation file
//
#include "stdafx.h"
#include "SIMTOOL.h"
#include "DialDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDialDlg dialog
extern CSIMTOOLApp theApp;
CDialDlg::CDialDlg(CWnd* pParent /*=NULL*/)
: CDialog(CDialDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CDialDlg)
//}}AFX_DATA_INIT
}
void CDialDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDialDlg)
DDX_Control(pDX, IDC_DEVINFO, m_DevInfo);
DDX_Control(pDX, IDC_ETUSERNAME, m_UserName);
DDX_Control(pDX, IDC_ETPASSWORD, m_PassWord);
DDX_Control(pDX, IDC_ETDIALNUM, m_DialNum);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDialDlg, CDialog)
//{{AFX_MSG_MAP(CDialDlg)
ON_BN_CLICKED(IDC_BTNDIAL, OnBtndial)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDialDlg message handlers
void CDialDlg::OnBtndial()
{
// TODO: Add your control notification handler code here
CString strUserName(_T("")), strPassWord(_T("")), strPhoneNum(_T("")), strModemName(_T(""));
char un[30], pw[30], pn[30], mn[200];
memset(un, 0, 30);
memset(pw, 0, 30);
memset(pn, 0, 30);
memset(mn, 0, 200);
m_UserName.GetWindowText(un, 30);
m_PassWord.GetWindowText(pw, 30);
m_DialNum.GetWindowText(pn, 30);
m_DevInfo.GetWindowText(mn, 200);
strUserName = un;
strPassWord = pw;
strPhoneNum = pn;
strModemName = mn;
theApp.SetUserName(strUserName);
theApp.SetPassWord(strPassWord);
theApp.SetPhoneNum(strPhoneNum);
theApp.SetModemName(strModemName);
OnCancel();
//m_stadlg.Create(IDD_CONNSTATUSDLG);
m_stadlg.DoModal();
}
void CDialDlg::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
}
BOOL CDialDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
if(!FillModemCombo())
{
GetDlgItem(IDC_BTNDIAL)->EnableWindow(FALSE);
m_DevInfo.SetWindowText("没有安装ADBON GPRS MODEM");
UpdateData(TRUE);
}
m_DialNum.SetWindowText("*99***1#");
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
BOOL CDialDlg::FillModemCombo()
{
int iModemCount = theApp.GetModemCount();
BOOL bRet;
bRet = FALSE;
if(iModemCount == 0)
{
//m_strStatus = "There is no modem installed in your computer!";
return FALSE;
}
else if(iModemCount < 0)
{
//m_strStatus = "Fail to get modem count!";
return FALSE;
}
CString* strModemName = new CString[iModemCount];
BOOL bResult = theApp.GetModemName();
strModemName = theApp.GetModemEnum();
if(bResult)
{
for(int i = 0; i < iModemCount; i++)
{
if (strModemName[i] == "ADBON GPRS MODEM 115200")
{
m_DevInfo.SetWindowText(strModemName[i]);
UpdateData(TRUE);
bRet = TRUE;
}
}
}
else
//m_strStatus = "Fail to get Modem name!";
delete []strModemName;
//return bResult;
return bRet;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -