17
:
:
1. -
2. MFC
3. GetDlgltem
-
, MFC , MFC. , - , , , . , , , . , Win32 CreateWindow CreateWindowEx, - .
CreateWindow:
HWND CreateWindow(
LPCTSTR lpClassName // '
LPCTSTR lpWindowName // '
DWORD dwStyle //
int II
int //
int nWidth //
int nHeight //
HWND hWndParent //
HMENU hMenu //
instance hlnstance //
LPVOID lpParam //
);
CreateWindow ' (window class name). (common control) '. Windows RegisterClass, (window procedure) . , CreateWindow, Windows , , , , . CommCtrl.h. CommCtrl.h, ' (edit control). , : UNICODE ASCII.
// '
#define WC_EDITA "Edit"
#define WC_EDITW L"Edit"
#ifdef UNICODE
#define WC_EDIT WC_EDITW
fielse
#define WC__EDIT WC_EDITA
#endif
#else
#define WC_EDIT "Edit"
#endif
' MFC? , , MFC, , MFC , , , .
MFC C++. , CEdit, (edit control); CButton (button) CWnd, - m_hwnd, , - .
|
|
. , , MFC, . , MFC .
Windows
MFC Windows
(Button) CButton BUTTON
(List box) CListBox LISTBOX
(Edit control) CEdit EDIT
,
(Combo box) CComboBox COMBOBOX
MFC
MFC . - . , , , SDK. Win32, . :
HWND hwnd =::GetDlgltem (hvmdDialog, IDC__COMB01);
::SendMessage (hwnd, CB_ADDSTRING, 0L, (LPARAM) "GetDlgItem");
, - ( CComboBox), :
combobox.AddString(GetDlgItem);
, , , combobox.
, , MFC ( , CWnd 䳺 -, HWND ), , - . - CComboBox::AddString ( afxwin2. inl).
_AFXWIN_INLINE int CComboBox::AddString(LPCTSTR IpszString)
{
ASSERT(::IsWindow(m_hWnd));
return (int)::SendMessage(m_hWnd, CB_ADDSTRING, 0, (LPARAM) IpszString);
}
MFC SDK Win32.
- HWND, - ( ).
- ' ( CB_ADDSTRING). , - (, AddString).
- ( WPARAM, ) - . - .
, , . SDK Win32 , , , , . MFC , , , , , , , , 볺 .
|
|
', MFC , ', . .
- GetDlgltem.
- DDX .
- Attach .
- Attach.
, Control Attaching. .