?? namedlg.cpp
字號:
// NameDlg.cpp : implementation file
//
#include "stdafx.h"
#include "five.h"
#include "Table.h"
#include "NameDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CNameDlg dialog
CNameDlg::CNameDlg(CWnd* pParent /*=NULL*/)
: CDialog(CNameDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CNameDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CNameDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CNameDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CNameDlg, CDialog)
//{{AFX_MSG_MAP(CNameDlg)
ON_EN_UPDATE(IDC_EDIT_NAME, OnUpdateEditName)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CNameDlg message handlers
void CNameDlg::OnUpdateEditName()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function to send the EM_SETEVENTMASK message to the control
// with the ENM_UPDATE flag ORed into the lParam mask.
// TODO: Add your control notification handler code here
CString str;
GetDlgItemText( IDC_EDIT_NAME, str );
GetDlgItem( IDOK )->EnableWindow( !str.IsEmpty() );
}
BOOL CNameDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
CEdit *pEdit = (CEdit *)GetDlgItem( IDC_EDIT_NAME );
// 讀取玩家姓名
CFiveApp *pApp = (CFiveApp *)AfxGetApp();
::GetPrivateProfileString( _T("Options"), _T("Name"), _T("Renjiu"), m_strName, 15, pApp->m_szIni );
// 設置文本及其它雜項
pEdit->LimitText( 15 );
pEdit->SetWindowText( m_strName );
pEdit->SetSel( 0, -1 );
pEdit->SetFocus();
return FALSE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CNameDlg::OnOK()
{
// TODO: Add extra validation here
// 寫入玩家姓名
CFiveApp *pApp = (CFiveApp *)AfxGetApp();
GetDlgItemText( IDC_EDIT_NAME, m_strName, 10 );
::WritePrivateProfileString( _T("Options"), _T("Name"), m_strName, pApp->m_szIni );
// 設置玩家姓名
CTable *pTable = (CTable *)GetParent()->GetDlgItem( IDC_TABLE );
pTable->m_strMe = m_strName;
CDialog::OnOK();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -