"Zero-based index"
Hi everyone. I''ve been looking around MSDN at some messages that add strings to combo/list boxes...etc. Anyways, msot of them say to be given a ''zero-based'' index at which to insert the new item. As I understand it, its just the position, with ''0'' being the first item..etc. The thing I don''t get is that on some: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/listboxes/listboxreference/listboxmessages/lb_insertstring.asp
It asks for the zero-based index, but if the parameter is ''1'', it is added to the end. How would you add an item to the second slot (1) if setting the parameter to 1 adds it to the end? Thanks.
index
Value of wParam. Specifies the zero-based index of the position at which to insert the string. If this parameter is –1, the string is added to the end of the list.
a typo. its correct in the local msdn of vs6..
"take a look around" - limp bizkit
www.google.com
Value of wParam. Specifies the zero-based index of the position at which to insert the string. If this parameter is –1, the string is added to the end of the list.
a typo. its correct in the local msdn of vs6..
"take a look around" - limp bizkit
www.google.com
From my MSDN on CD (version 6 of MSVC):
LB_INSERTSTRING
wParam = (WPARAM) index; // item index
lParam = (LPARAM) (LPCTSTR) lpsz; // address of string to insert
Parameters
index
Value of wParam. Specifies the zero-based index of the position at which to insert the string. If this parameter is –1, the string is added to the end of the list.
Windows 95 and Windows 98: 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.
lpsz
Value of lParam. Pointer to the null-terminated string to be inserted.
If you create the list box with an owner-drawn style but without the LBS_HASSTRINGS style, the value of the lpsz parameter is stored as item data instead of the string it would otherwise point to. You can send the LB_GETITEMDATA and LB_SETITEMDATA messages to retrieve or modify the item data.
As you can see, it is supposed to say -1, not 1.
--------------------
You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming
You are unique. Just like everybody else.
"Mechanical engineers design weapons; civil engineers design targets."
"Sensitivity is adjustable, so you can set it to detect elephants and other small creatures." -- Product Description for a vibration sensor
LB_INSERTSTRING
wParam = (WPARAM) index; // item index
lParam = (LPARAM) (LPCTSTR) lpsz; // address of string to insert
Parameters
index
Value of wParam. Specifies the zero-based index of the position at which to insert the string. If this parameter is –1, the string is added to the end of the list.
Windows 95 and Windows 98: 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.
lpsz
Value of lParam. Pointer to the null-terminated string to be inserted.
If you create the list box with an owner-drawn style but without the LBS_HASSTRINGS style, the value of the lpsz parameter is stored as item data instead of the string it would otherwise point to. You can send the LB_GETITEMDATA and LB_SETITEMDATA messages to retrieve or modify the item data.
As you can see, it is supposed to say -1, not 1.
--------------------
You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming
You are unique. Just like everybody else.
"Mechanical engineers design weapons; civil engineers design targets."
"Sensitivity is adjustable, so you can set it to detect elephants and other small creatures." -- Product Description for a vibration sensor
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement