📄 propertydlg.cpp
字号:
// PropertyDlg.cpp : implementation file
//
#include "stdafx.h"
#include "tapiutils.h"
#include "DialDlg.h"
#include "netpro.h"
#include "PropertyDlg.h"
#include "netproDlg.h"
#include "regkey.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern CSystemStatus SystemStatus;
/////////////////////////////////////////////////////////////////////////////
// CPropertyDlg dialog
CPropertyDlg::CPropertyDlg(CWnd* pParent /*=NULL*/)
: CDialog(CPropertyDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CPropertyDlg)
m_cDN = _T("");
m_cTipInfo = _T("");
m_bDisDial = SystemStatus.bDisDial;
//}}AFX_DATA_INIT
/* CMyRegKey regKey;
long lResult = regKey.Open(HKEY_LOCAL_MACHINE,_T("SOFTWARE\\FFCS\\VSL IPHONE\\Config"));
if(lResult==ERROR_SUCCESS)
{
regKey.Read(_T("TELEPHONENUMBER"),m_cDN);
}
*/
}
void CPropertyDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPropertyDlg)
DDX_Text(pDX, IDC_DN, m_cDN);
DDX_Text(pDX, IDC_TIPINFO, m_cTipInfo);
DDX_Check(pDX, IDC_CHKDISDIAL, m_bDisDial);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPropertyDlg, CDialog)
//{{AFX_MSG_MAP(CPropertyDlg)
ON_BN_CLICKED(IDC_UPDATE, OnUpdate)
// ON_WM_CTLCOLOR()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPropertyDlg message handlers
void CPropertyDlg::OnUpdate()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
if( m_cDN.GetLength() == 7 )
{
CString res = m_cDN.SpanIncluding( "0123456789" );
if( res == m_cDN )
{
// CNetproDlg* m_DialogTemp=(CNetproDlg*)GetParent();
m_DialogTemp->m_oDN=m_cDN;
m_DialogTemp->m_TrayIcon.SetTooltipText(_T("FFCS VSL 电话号码: ")+m_cDN);
OnOK( );
}
else
MessageBox("号码输入错误,不能包含除数字外的其他字符","号码输入错误",MB_ICONSTOP);
}
else
MessageBox("号码输入错误,位数不等于7位","号码输入错误",MB_ICONSTOP);
SystemStatus.bDisDial=m_bDisDial;
}
BOOL CPropertyDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_brush.CreateSolidBrush(RGB(100,135,238)); // color white brush
m_DialogTemp=(CNetproDlg*)GetParent();
m_cDN = m_DialogTemp->m_oDN;
if ( m_DialogTemp->m_FillDNFirst == TRUE )
{
m_cTipInfo = "您是新用户,请输入7位电话号码";
::SetDlgItemText(GetSafeHwnd(),IDC_UPDATE,"提交");
}
else
{
m_cTipInfo = "请输入您的7位电话号码";
::SetDlgItemText(GetSafeHwnd(),IDC_UPDATE,"确认");
}
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
HBRUSH CPropertyDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
/* HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
// TODO: Return a different brush if the default is not desired
return hbr;
*/
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
switch (nCtlColor)
{
//Edit controls need white background and black text
//Note the 'return hbr' which is needed to draw the Edit
//control's internal background (as opposed to text background)
case CTLCOLOR_EDIT:
pDC->SetTextColor(RGB(255,0,0));
pDC->SetBkColor(RGB(255,255,255));
return hbr;
//Static controls need black text and same background as m_brush
case CTLCOLOR_STATIC:
LOGBRUSH logbrush;
m_brush.GetLogBrush( &logbrush );
pDC->SetTextColor(RGB(255,255,0));
pDC->SetBkColor(logbrush.lbColor);
return m_brush;
//For listboxes, scrollbars, buttons, messageboxes and dialogs,
//use the new brush (m_brush)
case CTLCOLOR_BTN:
pDC->SetTextColor(RGB(255,255,0));
pDC->SetBkColor(RGB(255,255,255));
return m_brush;
case CTLCOLOR_LISTBOX:
case CTLCOLOR_SCROLLBAR:
case CTLCOLOR_MSGBOX:
case CTLCOLOR_DLG:
return m_brush;
//This shouldn't occurr since we took all the cases, but
//JUST IN CASE, return the new brush
default:
return m_brush;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -