본문 바로가기

Programming/MFC

GetDlgItem

CWnd* GetDlgItem(
   int nID
) const;
void GetDlgItem(
   int nID,
   HWND* phWnd
) const;

Parameters
nID
Specifies the identifier of the control or child window to be retrieved.
phWnd
A pointer to a child window.
Return Value
A pointer to the given control or child window. If no control with the integer ID given by the nID parameter exists, the value is NULL.
The returned pointer may be temporary and should not be stored for later use.
Remarks
The pointer returned is usually cast to the type of control identified by nID.
Example
// uses GetDlgItem to return a pointer to a user interface control
CEdit* pBoxOne;
pBoxOne = (CEdit*) GetDlgItem(IDC_EDIT1);
GotoDlgCtrl(pBoxOne);

리소스 ID 에 해당하는 윈도우 객체의 포인터를 반환
따라서 필요한 컨트롤에 맞게 캐스트 연산 하여 사용한다.


'Programming > MFC' 카테고리의 다른 글

WM_MOUSELEAVE 메세지 VS 2005 에서 설정 방법  (0) 2009.11.06