Skip to content

Commit e79ab35

Browse files
Merge pull request #6164 from MicrosoftDocs/main
Auto Publish – main to live - 2025-11-21 06:00 UTC
2 parents ff7224b + bca8306 commit e79ab35

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

.github/copilot-instructions.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ When writing documentation, follow these guidelines:
1111

1212
## Grammar
1313

14+
* Avoid "we"/"our" referring to documentation authors
1415
* Use present tense verbs (is, open) instead of past tense (was, opened). For example, "The method returns a value" instead of "The method will return a value."
1516
* Write factual statements and direct commands. Avoid hypotheticals.
1617
* Use active voice where the subject performs the action.
@@ -81,7 +82,8 @@ When writing documentation, follow these guidelines:
8182

8283
## Adding links
8384

84-
* Add links to related topics and resources where appropriate.
85+
* Add links to related topics and resources where appropriate.
86+
* Use relative links for files in this repo
8587
* Links to other documentation articles should be relative, not absolute. Start relative links with `/docs/` and include the `.md` suffix. If you add a link to another page on learn.microsoft.com that's not in this repo, remove https://learn.microsoft.com/en-us from the link.
8688
* Links to bookmarks within the same article should be relative and start with `#`.
8789
* Link descriptions should be descriptive and make sense on their own. Don't use "click here" or "this link" or "here".

docs/mfc/codesnippet/CPP/clistbox-class_23.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// Initialize the storage of the list box to be 256 strings with
2-
// about 10 characters per string, performance improvement.
3-
int n = m_myListBox.InitStorage(256, 16 * sizeof(TCHAR));
1+
// Reserve space in the list box for 256 additional strings with
2+
// about 15 characters per string.
3+
int n = m_myListBox.InitStorage(256, 256 * (15 + 1) * sizeof(TCHAR));
44
ASSERT(n != LB_ERRSPACE);
55

66
// Add 256 items to the list box.

docs/mfc/reference/clistbox-class.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -873,20 +873,22 @@ int InitStorage(
873873
### Parameters
874874
875875
*`nItems`*<br/>
876-
Specifies the number of items to add.
876+
Specifies the number of items to for which to reserve space.
877877
878878
*`nBytes`*<br/>
879-
Specifies the amount of memory, in bytes, to allocate for item strings.
879+
Specifies the amount of additional memory, in bytes, to allocate for item strings.
880880
881881
### Return Value
882882
883883
If successful, the maximum number of items that the list box can store before a memory reallocation is needed, otherwise `LB_ERRSPACE`, meaning not enough memory is available.
884884
885885
### Remarks
886886
887-
Call this function before adding a large number of items to a `CListBox`.
887+
You can call this function before adding a large number of items to a `CListBox`.
888888
889-
This function helps speed up the initialization of list boxes that have a large number of items (more than 100). It preallocates the specified amount of memory so that subsequent [`AddString`](#addstring), [`InsertString`](#insertstring), and [`Dir`](#dir) functions take the shortest possible time. You can use estimates for the parameters. If you overestimate, some extra memory is allocated; if you underestimate, the normal allocation is used for items that exceed the preallocated amount.
889+
This function helps speed up the initialization of list boxes that have a large number of items (more than 100). It preallocates the specified amount of memory so that subsequent [`AddString`](#addstring), [`InsertString`](#insertstring), and [`Dir`](#dir) functions are more efficient. You can use estimates for the parameters. If you overestimate, the extra memory remains allocated; if you underestimate, the list box will allocate additional memory as necessary.
890+
891+
The memory required to store a string includes the null terminator. Therefore, if you plan to add 100 strings, each with a length of 10 characters, you would pass a *wParam* of 100 and an *lParam* of 100 &times; (10 + 1) &times; sizeof(TCHAR).
890892
891893
Windows 95/98 only: The *`nItems`* parameter is limited to 16-bit values. This means list boxes cannot contain more than 32,767 items. Although the number of items is restricted, the total size of the items in a list box is limited only by available memory.
892894

0 commit comments

Comments
 (0)