Much like in VB, I figured I would need to create some fancy listbox functions for C++.


Here is one I cannot seem to get to work properly.
PHP Code:
//------------------
//Add an item to the list
//------------------
void ListBox::AddItem(charItem)
{
    
//add string
    
SendMessage(m_hwndLB_ADDSTRING0, (LPARAM)Item);
    
SendMessage(m_hwndLB_SETITEMDATAm_IndexCount, (LPARAM)m_IndexCount);
    
m_IndexCount++;
}


//------------------
//Clear the entire list
//------------------
void ListBox::Clear()
{
    
LRESULT lRet;
    for (
int Index 0Index m_IndexCount+1Index++)
    {
        
lRet SendMessage(m_hwndLB_DELETESTRINGIndex,0);
    }

    
m_IndexCount 0;

So I add a bunch of strings using the Add function, then I try and clear it all.

Well now and then it clears all but one, sometimes all but two depending on how many I add. If it clears all but 1 or 2, or more..then I can just keep pressing it and it gets rid of everything one at a time.

What is going on????