📄 addresspage.cpp
字号:
// AddressPage.cpp : implementation file
//
#include "stdafx.h"
#include "gtmpeg.h"
#include "AddressPage.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////
IMPLEMENT_DYNCREATE(CAddressPage, CPropertyPage)
/////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////
CAddressPage::CAddressPage() : CPropertyPage(CAddressPage::IDD)
{
//{{AFX_DATA_INIT(CAddressPage)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_bEnable=FALSE;
}
/////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////
CAddressPage::~CAddressPage()
{
}
/////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////
void CAddressPage::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAddressPage)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
/////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////
BEGIN_MESSAGE_MAP(CAddressPage, CPropertyPage)
//{{AFX_MSG_MAP(CAddressPage)
ON_BN_CLICKED(IDC_STATIC_1, OnStatic1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////
BOOL CAddressPage::OnInitDialog()
{
CPropertyPage::OnInitDialog();
SetInfoTxt();
Enable(m_bEnable);
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////
void CAddressPage::Enable(BOOL bEnable)
{
for(int i=0;i<theApp.m_nMaxChannels;i++)
{
GetDlgItem(IDC_PLACE_EDIT1+i)->EnableWindow(bEnable);
GetDlgItem(IDC_PAN_ADDRESS1+i)->EnableWindow(bEnable);
}
}
/////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////
void CAddressPage::SetInfoTxt()
{
CEdit *pEdit=NULL;
CString sTxt;
CString sEntry;
for(int i=0;i<theApp.m_nChannels;i++)
{
sEntry.Format("Channel%02d_Txt",i+1);
sTxt=AfxGetApp()->GetProfileString("Info",sEntry);
pEdit=(CEdit *)GetDlgItem(IDC_PLACE_EDIT1+i);
pEdit->SetWindowText(sTxt);
//
sEntry.Format("Pan%02d_Address",i+1);
sTxt.Format("%d",AfxGetApp()->GetProfileInt("Info",sEntry,i));
pEdit=(CEdit *)GetDlgItem(IDC_PAN_ADDRESS1+i);
pEdit->SetWindowText(sTxt);
}
}
/////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////
void CAddressPage::OnOK()
{
CEdit *pEdit=NULL;
CString sTxt;
CString sEntry;
for(int i=0;i<theApp.m_nChannels;i++)
{
pEdit=(CEdit *)GetDlgItem(IDC_PLACE_EDIT1+i);
pEdit->GetWindowText(sTxt);
sEntry.Format("Channel%02d_Txt",i+1);
AfxGetApp()->WriteProfileString("Info",sEntry,sTxt);
//
sEntry.Format("Pan%02d_Address",i+1);
AfxGetApp()->WriteProfileInt("Info",sEntry,GetDlgItemInt(IDC_PAN_ADDRESS1+i,NULL,FALSE));
}
CPropertyPage::OnOK();
}
/////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////
void CAddressPage::OnStatic1()
{
m_bEnable=!m_bEnable;
Enable(m_bEnable);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -