// PATCH: Windows 98 combobox fix (common controls version < 6) // References and documentation links for this code: // http://blogs.msdn.com/b/oldnewthing/archive/2006/03/10/548537.aspx // ! http://vbnet.mvps.org/index.html?code/comboapi/comboheight.htm void AdjustComboBoxHeight(HWND hWndCmbBox, DWORD MaxVisItems) { RECT rc; GetWindowRect(hWndCmbBox, &rc); rc.right -= rc.left; ScreenToClient(GetParent(hWndCmbBox), (POINT *) &rc); rc.bottom = (MaxVisItems + 2) * SendMessage(hWndCmbBox, CB_GETITEMHEIGHT, 0, 0); MoveWindow(hWndCmbBox, rc.left, rc.top, rc.right, rc.bottom, TRUE); }
2015.04.15