Limiting the Number of Entries in a List BoxLast reviewed: November 2, 1995Article ID: Q78241 |
The information in this article applies to:
SUMMARYAlthough there is no single message that restricts the number of entries (lines) allowed in a list box, the limit can be imposed through the use of subclassing.
MORE INFORMATIONThe following code fragment is an excerpt from a subclassing function that can be used to restrict the number of entries in a list box to no more than the constant MAXENTRIES where the lpfnOldLBFn variable points to the original list box window procedure: long FAR PASCAL SubClassFn(hWnd, message, wParam, lParam) HWND hWnd; unsigned message; WORD wParam; LONG lParam; { int iCount; switch (message) { case LB_ADDSTRING: case LB_INSERTSTRING: iCount = SendMessage(hWnd, LB_GETCOUNT, 0, 0L); if (iCount > MAXENTRIES) { /* Insert action here to inform user of limit violation */ break; } /* fall through if less entries than maximum */ default: return CallWindowProc(lpfnOldLBProc, hWnd, message, wParam, lParam); }}
|
Additional reference words: 3.00 3.10 3.50 4.00 95 list box
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |