CWnd::BindDefaultProperty
Binds the calling object's default simple bound property (such as an edit control), as marked in the type library, to the underlying cursor that is defined by the DataSource, UserName, Password, and SQL properties of the data-source control.
void BindDefaultProperty(
DISPID dwDispID,
VARTYPE vtProp,
LPCTSTR szFieldName,
CWnd * pDSCWnd
);
Параметры
dwDispID
Specifies the DISPID of a property on a data-bound control that is to be bound to a data-source control.vtProp
Specifies the type of the property to be bound — for example, VT_BSTR, VT_VARIANT, and so on.szFieldName
Specifies the name of the column, in the cursor provided by the data-source control, to which the property will be bound.pDSCWnd
Points to the window that hosts the data-source control to which the property will be bound. Call GetDlgItem with the resource ID of the DCS's host window to retrieve this pointer.
Заметки
The CWnd object on which you call this function must be a data-bound control.
Пример
BindDefaultProperty might be used in the following context:
BOOL CMyDlg::OnInitDialog()
{
...
CWnd* pDSC = GetDlgItem(IDC_DATASOURCE);
CWnd* pMyBound = GetDlgItem(IDC_MYBOUNDCTRL1);
pMyBound->BindDefaultProperty(0x1, VT_BSTR, _T("ContactFirstName"), pDSC);
...
return TRUE;
}
Требования
Header: afxwin.h