Article ID: 201116 - View products that this article applies to.
This article was previously published under Q201116
This article has been archived. It is offered "as is" and will no longer be updated.
On the Macintosh, the combo box messages CB_GETTOPINDEX and CB_SETTOPINDEX fail and always return zero (0).
There are no message handlers for these messages in the combo-box window procedure in the Windows Portability Library.
Obtain a pointer to the list box portion of the combo box, and use LB_GETTOPINDEX and LB_SETTOPINDEX instead.
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
The combo-box control is composed of an edit control and a list-box control. For additional information about combo boxes, please see the following article in the Microsoft Knowledge Base:
65881On the Intel side, the edit control is the first child of the combo box. For a simple combo box, the Macintosh has the list-box control as the first control.
(https://support.microsoft.com/kb/65881/EN-US/ )INFO: The Parts of a Windows Combo Box and How They Relate
The window handle to the list box can be obtained using GetWindow. Once a valid handle is obtained, using the LB_GETTOPINDEX and LB_SETTOPINDEX messages provides the same functionality as CB_GETTOPINDEX and CB_SETTOPINDEX.
The sample code below shows the MFC implementation:
(c) Microsoft Corporation 1999, All Rights Reserved. Contributions by Adam Kim, Microsoft Corporation.
Article ID: 201116 - Last Review: October 11, 2013 - Revision: 2.0