文本輸入框
// DlgTest2.cpp : implementation file//#include "stdafx.h"#include "Text.h"#include "DlgTest2.h"#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE[] = __FILE__;#endif/////////////////////////////////////////////////////////////////////////////// CDlgTest2 dialogCDlgTest2::CDlgTest2(CWnd* pParent /*=NULL*/): CDialog(CDlgTest2::IDD, pParent){//{{AFX_DATA_INIT(CDlgTest2)m_strEdit1 = _T("");//}}AFX_DATA_INIT}void CDlgTest2::DoDataExchange(CDataExchange* pDX){CDialog::DoDataExchange(pDX);//{{AFX_DATA_MAP(CDlgTest2)DDX_Text(pDX, IDC_EDIT1, m_strEdit1);//}}AFX_DATA_MAP}BEGIN_MESSAGE_MAP(CDlgTest2, CDialog)//{{AFX_MSG_MAP(CDlgTest2)ON_BN_CLICKED(IDC_NUMBER_DLG2_LABEL1, OnLABEL1_CLICK)ON_BN_CLICKED(IDC_BUTTON1, OnButton1)ON_BN_CLICKED(IDC_BUTTON2, OnBtn2_Click)ON_BN_CLICKED(IDC_LABEL2, On_Label2_CLICK)ON_BN_CLICKED(IDC_BUTTON3, On_Btn3_GetEdit1Value)ON_BN_CLICKED(IDC_BUTTON4, On_BTN4_SetEdit1Value)//}}AFX_MSG_MAPEND_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////// CDlgTest2 message handlersvoid CDlgTest2::OnLABEL1_CLICK() {MessageBox("hello謝謝點擊");}void CDlgTest2::OnButton1() {// TODO: Add your control notification handler code hereMessageBox("hello謝謝點擊Button");}void CDlgTest2::OnBtn2_Click() {CString str;((CEdit*)this->GetDlgItem(IDC_EDIT1))->GetWindowText(str);MessageBox(str);}void CDlgTest2::On_Label2_CLICK() {MessageBox("LABEL2 clicked");}void CDlgTest2::On_Btn3_GetEdit1Value() {UpdateData();MessageBox(this->m_strEdit1);}void CDlgTest2::On_BTN4_SetEdit1Value() {this->m_strEdit1="吳xx";UpdateData(FALSE);}
http://hi.baidu.com/hushaobo_km/blog/item/d4f0b12d114e673f359bf77e.html