📄 behaodialog.cpp
字号:
// BehaoDialog.cpp : implementation file
//
#include "stdafx.h"
#include "Modem3.h"
#include "BehaoDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CBehaoDialog dialog
CBehaoDialog::CBehaoDialog(CWnd* pParent /*=NULL*/)
: CDialog(CBehaoDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(CBehaoDialog)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CBehaoDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CBehaoDialog)
DDX_Control(pDX, IDC_COMBO1, m_Com);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CBehaoDialog, CDialog)
//{{AFX_MSG_MAP(CBehaoDialog)
ON_BN_CLICKED(ID_BEHAO, OnBehao)
ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CBehaoDialog message handlers
void CBehaoDialog::OnBehao()
{
// TODO: Add your control notification handler code here
CString m_GetString,strTemp,str;
m_Com.GetLBText(m_Com.GetCurSel(),m_GetString);
if(m_GetString=="")
{
GetDlgItem(ID_BEHAO)->EnableWindow(FALSE);
}
else if(m_GetString!="")
{
GetDlgItem(ID_BEHAO)->GetWindowText(str);
if(str=="拨号")
strTemp="ATDT"+m_GetString+"\r\n";
if(str=="挂断")
strTemp="ATH0\r\n";
int i;
char TxData[100];
int Count=strTemp.GetLength();
for(i=0;i<Count;i++)
TxData[i]=strTemp.GetAt(i);
CByteArray array;
array.RemoveAll();
array.SetSize(Count);
for(i=0;i<Count;i++)
array.SetAt(i,TxData[i]);
CWnd *ppWnd=CWnd::FindWindow(NULL,"modem3");
((CModem3Dlg*) ppWnd)->m_Com.SetOutput(COleVariant(array));
if(str=="拨号")
{GetDlgItem(ID_BEHAO)->SetWindowText("挂断");
((CModem3Dlg*) ppWnd)->m_str="挂断";
}
if(str=="挂断")
{ GetDlgItem(ID_BEHAO)->SetWindowText("拨号");
((CModem3Dlg*) ppWnd)->m_str="拨号";
}
}
CDialog::OnOK();
}
BOOL CBehaoDialog::OnInitDialog()
{
CDialog::OnInitDialog();
m_Com.SetCurSel(0);
CWnd *ppWnd=CWnd::FindWindow(NULL,"modem3");
GetDlgItem(ID_BEHAO)->SetWindowText( ((CModem3Dlg*) ppWnd)->m_str);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CBehaoDialog::OnSelchangeCombo1()
{
// TODO: Add your control notification handler code here
GetDlgItem(ID_BEHAO)->EnableWindow(TRUE);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -