msg is defined as
char* msg
as a parameter of a function. The creation of the message is rather extensive so I would rather not try to post it here.
Just a quick insertion here: I am always automatically selecting the next added string in the listbox so he would automatically scroll down as more messages appear.
So I found out another thing:
I tried limiting the string to a certain length and he showed it again with an approximate length of 4800 chars. But as I tried a little higher values he sometimes showed the string and sometimes not.
After some more inspection it seems to me that he doesnt display the string when the message LB_ADDSTRING took too long and LB_SETCURSEL has been called in the meantime (this selects the posted string).
So I think I have two options here:
- I read about LB_INITSTORAGE to allocate some memory so the listbox loads the elements faster (
http://msdn.microsoft.com/en-us/library/windows/desktop/bb761319%28v=vs.85%29.aspx). But would this help here? I dont even know if this is also meant to be used for strings (though characters are also elements that are added to the listbox so I guess yes).
Btw there is also an interesting mention about the listbox limits
Windows 95/Windows 98/Windows Millennium Edition (Windows Me) : The wParam 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 in bytes of the items in a list box is limited only by available memory. |
So I guess in newer System wParam is limited to 32bit or higher so the number of items would be (2^32)/2 items?
- cut off the strings in some parts so they are displayed again without any time delay
I will try LB_INITSTORAGE first but I am unsure about the size I should allocate. What would be a good value to start with?