How to display a grid with a Record Beam in a Dialog?

You can find the original code in the gxquery sample (sampdlg.cpp/.h).

First, you should place a user control in the dialog, with class name "GXWND", so that you can subclass this control with the CGXRecordInfoWnd.

Example for dialog template:

IDD_DLGRECORDWND DIALOG DISCARDABLE  0, 0, 326, 206
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog with ODBC grid"
FONT 8, "MS Sans Serif"
BEGIN
    GROUPBOX        "&Query Results",IDC_STATIC,5,7,312,176
    DEFPUSHBUTTON   "&OK",IDOK,5,187,50,14,NOT WS_TABSTOP
    PUSHBUTTON      "&Cancel",IDCANCEL,72,186,50,14
    CONTROL         "User1",IDC_ODBCSAMPLEGRID,"GXWND",WS_BORDER | 
                    WS_TABSTOP,12,20,299,158
END

Next, in your dialog class, you should declare objects for your CGXGridWnd-derived class and for the CGXRecordInfoWnd.

/////////////////////////////////////////////////////////////////////////////
// CRecordWndSampleDialog dialog
class CRecordWndSampleDialog : public CDialog
{
// Construction
public:
   CRecordWndSampleDialog(CWnd* pParent = NULL);   // standard constructor
// Dialog Data
   //{{AFX_DATA(CRecordWndSampleDialog)
   enum { IDD = IDD_DLGRECORDWND };
      // NOTE: the ClassWizard will add data members here
   //}}AFX_DATA
   CGXGridWnd m_wndGrid;
   CGXRecordInfoWnd m_infoWnd;
// Overrides
   // ClassWizard generated virtual function overrides
   //{{AFX_VIRTUAL(CRecordWndSampleDialog)
   protected:
   virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
   //}}AFX_VIRTUAL
// Implementation
protected:
   // Generated message map functions
   //{{AFX_MSG(CRecordWndSampleDialog)
   virtual BOOL OnInitDialog();
   //}}AFX_MSG
   DECLARE_MESSAGE_MAP()
};
Finally, you should override OnInitDialog and subclass
the "GXWND" control:
/////////////////////////////////////////////////////////////////////////////
// CRecordWndSampleDialog message handlers
BOOL CRecordWndSampleDialog::OnInitDialog() 
{
   CDialog::OnInitDialog();
   
   m_infoWnd.SubclassDlgItem(IDC_ODBCSAMPLEGRID, this);
   m_wndGrid.Create(0, CRect(0,0,1,1), &m_infoWnd, IDC_ODBCSAMPLEGRID);
   m_infoWnd.AttachWnd(&m_wndGrid);
   m_wndGrid.Initialize();
   m_wndGrid.SetFocus();
   
   return TRUE;  // return TRUE unless you set the focus to a control
                 // EXCEPTION: OCX Property Pages should return FALSE
}

Now, it should work.