1、GetDlgItem
1).CWindow::GetDlgItem
HWND GetDlgItem( intnID)const;
说明——
参数 nID:接收消息的控件的标识;
返回值:标识所标记的控制窗口句柄;
2).CWnd::GetDlgItem
CWnd* GetDlgItem ( intnID) const;
void CWnd::GetDlgItem( int nID, HWND *phWnd) const;
说明——
参数 nID:接收消息的控件的标识;
参数phWnd:子类窗口的指针;
返回值:标识所标记的控件(或子类窗口)的指针;
Example
// Uses GetDlgItem to return a pointer to a user interface control.
CEdit* pBoxOne;
pBoxOne = (CEdit*) GetDlgItem(IDC_EDIT1);
GotoDlgCtrl(pBoxOne);
3).Windows SDK
HWND GetDlgItem(
HWNDhDlg, // handle to dialog box
intnIDDlgItem// control identifier
);
参数说明:
hDlg:标识含有控件的对话框。
nlDDlgltem:指定将被检索的控件标识符。
2、
SetWindowText
Windows API宏,在WinUser.h中根据是否已定义Unicode被分别定义为SetWindowTextW和SetWindowTextA,这两个函数改变指定窗口的标题栏的文本内容(如果窗口有标题栏)。如果指定窗口是一个控件,则改变控件的文本内容。特别需要引起重视的是,【SetWindowText函数不改变在其他应用程序中的控件的文本内容,如果需要可以用另外一个SendMessage函数发送一条WM_SETTEXT消息】。