This documentation is archived and is not being maintained.


Call this member function to retrieve a pointer to the underlying cursor that is defined by the DataSource, UserName, Password, and SQL properties of the data-source control.

IUnknown * GetDSCCursor( );

Return Value

A pointer to a cursor that is defined by a data-source control. MFC takes care of calling AddRef for the pointer.


Use the returned pointer to set the ICursor property of a complex data-bound control, such as the data-bound grid control. A data-source control will not become active until the first bound control requests its cursor. This can happen either explicitly by a call to GetDSCCursor or implicitly by the MFC binding manager. In either case, you can force a data-source control to become active by calling GetDSCCursor and then calling Release on the returned pointer to IUnknown. Activation will cause the data-source control to attempt to connect to the underlying data source. The returned pointer might be used in the following context:


BOOL CMyDlg::OnInitDialog()
   // Find the child controls on the dialog
   CDBListBox* pList = (CDBListBox*)

   // Tell the MFC binding manager that we are
   // binding DISPID 3 to the data-source control.
   pList->BindProperty(0x3, pDSC);

   // Tell the listbox which field to expose as its
   // bound column

   // Tell the listbox which cursor and column
   // to populate its list from
   IPUNKNOWN *pcursor = pDSC->GetDSCCursor();
   if (!pcursor)
   // The pointer was not successfully assigned.
      return FALSE;
   // The pointer was successfully assigned,
   return TRUE;

See Also

CWnd Overview | Class Members | Hierarchy Chart | CWnd::BindDefaultProperty | CWnd::BindProperty