LB_ADDSTRING with SendMessage
Posted on 2002-04-17
Ok, This is where I'm at. I have an owner drawn listbox with a horizontal scrollbar. When a string item is added through the normal AddItem method of my control, The HorizontalExtent for the scrollbar is usually determined by the size of the string passed to the method. What I can't figure out is how to determine the width of the string item added, if a user populates my listbox via SendMessage API without using the AddItem method. I must find a way to determine what the added string item was so I can set my scrollbar.
I'm pretty sure I can hook the LB_ADDSTRING and LB_INSERTSTRING messages, but how do I get a reference to the actual string added, or even what the new index is, If these messages are hooked before the listbox is updated.