This documentation is archived and is not being maintained.


Retrieves from the combo box the width in pixels by which the list-box portion of the combo box can be scrolled horizontally.

UINT GetHorizontalExtent( ) const;

The scrollable width of the list-box portion of the combo box, in pixels.

This is applicable only if the list-box portion of the combo box has a horizontal scroll bar.

// The pointer to my combo box.
extern CComboBox* pmyComboBox;

// Find the longest string in the combo box.
CString str;
CSize   sz;
int     dx=0;
CDC*    pDC = pmyComboBox->GetDC();
for (int i=0;i < pmyComboBox->GetCount();i++)
   pmyComboBox->GetLBText( i, str );
   sz = pDC->GetTextExtent(str);

   if ( > dx)
      dx =;

// Set the horizontal extent only if the current extent is not large enough.
if (pmyComboBox->GetHorizontalExtent() < dx)
   ASSERT(pmyComboBox->GetHorizontalExtent() == dx);