TONEDLG.CPP
资源名称:tapi3.zip [点击查看]
上传用户:chinamans
上传日期:2013-03-17
资源大小:202k
文件大小:3k
源码类别:
TAPI编程
开发平台:
Visual C++
- // tonedlg.cpp : implementation file
- // (c) Dialogic corp 1995, 1996
- #include "stdafx.h"
- #include "resource.h"
- #include "tonedlg.h"
- #ifdef _DEBUG
- #undef THIS_FILE
- static char BASED_CODE THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CToneDlg dialog
- CToneDlg::CToneDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CToneDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CToneDlg)
- m_csF1 = _T("");
- m_csA1 = _T("");
- m_csA2 = _T("");
- m_csF2 = _T("");
- m_csDur = _T("");
- //}}AFX_DATA_INIT
- m_dwA1 = 40000;
- m_dwF1 = 1000;
- m_dwA2 = 40000;
- m_dwF2 = 1000;
- m_dwDur = 2000;
- }
- void CToneDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CToneDlg)
- DDX_Control(pDX, IDC_DUR, m_ctlDur);
- DDX_Control(pDX, IDC_FREQ2, m_ctlF2);
- DDX_Control(pDX, IDC_FREQ1, m_ctlF1);
- DDX_Control(pDX, IDC_AMP2, m_ctlA2);
- DDX_Control(pDX, IDC_AMP1, m_ctlA1);
- DDX_Control(pDX, IDC_BEEP, m_ctlBeep);
- DDX_Text(pDX, IDC_FREQ1, m_csF1);
- DDX_Text(pDX, IDC_AMP1, m_csA1);
- DDX_Text(pDX, IDC_AMP2, m_csA2);
- DDX_Text(pDX, IDC_FREQ2, m_csF2);
- DDX_Text(pDX, IDC_DUR, m_csDur);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CToneDlg, CDialog)
- //{{AFX_MSG_MAP(CToneDlg)
- ON_BN_CLICKED(IDC_BEEP, OnBeep)
- ON_BN_CLICKED(IDC_CUSTOM, OnCustom)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CToneDlg message handlers
- BOOL CToneDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
- m_csA1.Format("%ld", m_dwA1);
- m_csF1.Format("%ld", m_dwF1);
- m_csA2.Format("%ld", m_dwA2);
- m_csF2.Format("%ld", m_dwF2);
- m_csDur.Format("%ld", m_dwDur);
- UpdateData(FALSE);
- m_ctlBeep.SetCheck(1);
- if(m_bRunningOnNT) (GetDlgItem(IDC_CUSTOM))->EnableWindow(FALSE);
- OnBeep();
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void CToneDlg::OnOK()
- {
- UpdateData();
- m_bBeep = m_ctlBeep.GetCheck();
- m_dwA1 = atol((LPCTSTR)m_csA1);
- m_dwF1 = atol((LPCTSTR)m_csF1);
- m_dwA2 = atol((LPCTSTR)m_csA2);
- m_dwF2 = atol((LPCTSTR)m_csF2);
- m_dwDur = atol((LPCTSTR)m_csDur);
- if(m_dwA1 > 65535) m_dwA1 = 65535;
- if(m_dwA2 > 65535) m_dwA2 = 65535;
- if(m_dwF1 > 65535) m_dwF1 = 65535;
- if(m_dwF2 > 65535) m_dwF2 = 65535;
- if(m_dwDur > 65535) m_dwDur = 65535;
- CDialog::OnOK();
- }
- void CToneDlg::OnBeep()
- {
- m_ctlA1.EnableWindow(!m_ctlBeep.GetCheck());
- m_ctlA2.EnableWindow(!m_ctlBeep.GetCheck());
- m_ctlF1.EnableWindow(!m_ctlBeep.GetCheck());
- m_ctlF2.EnableWindow(!m_ctlBeep.GetCheck());
- }
- void CToneDlg::OnCustom()
- {
- OnBeep();
- }