|
-
Oct 30th, 2004, 08:27 PM
#1
Thread Starter
PowerPoster
Listbox.Clear .Add Methods
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(char* Item)
{
//add string
SendMessage(m_hwnd, LB_ADDSTRING, 0, (LPARAM)Item);
SendMessage(m_hwnd, LB_SETITEMDATA, m_IndexCount, (LPARAM)m_IndexCount);
m_IndexCount++;
}
//------------------
//Clear the entire list
//------------------
void ListBox::Clear()
{
LRESULT lRet;
for (int Index = 0; Index < m_IndexCount+1; Index++)
{
lRet = SendMessage(m_hwnd, LB_DELETESTRING, Index,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????
"From what was there, and was meant to be, but not of that was faded away." - - Steve Damm
"The polar opposite of nothingness is existance. When existance calls apon nothingness it shall return to nothingness." - - Steve Damm
"When you do things right, people won't be sure if you did anything at all." - - God from Futurama
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|