B
batvanio
Hi
I have a COM DLL which has a method that adds an item into a client -
provided listbox given the listbox handle (using Win32 SendMessage) -
Something like (pseudocode)
void AddItem (HWND clientHandle)
{
char sText[] = "blahblahblah";
SendMessage(clientHandle, LB_ADDSTRING, 0,(LPARAM) sText);
int iCur = SendMessage(clientHandle, LB_GETCOUNT, 0,0);
SendMessage(clientHandle, LB_SETCURSEL , iCur-1, (LPARAM) 0);
......
}
I have a C# client that has a list box on it. When I use AddItem, the
item is actually added in the listbox (I can see it). However, the
IistBox.Items.Count does not change (it is still 0) and if I try to use
something like
listbox.SelectedIndex = 0
or access the Items somehow, I get ArgumentOutOfRangeException
(because Items collection still shows no elements).
I tried different settings but with no success.
Any ideas?
Thanks.
Ivan
I have a COM DLL which has a method that adds an item into a client -
provided listbox given the listbox handle (using Win32 SendMessage) -
Something like (pseudocode)
void AddItem (HWND clientHandle)
{
char sText[] = "blahblahblah";
SendMessage(clientHandle, LB_ADDSTRING, 0,(LPARAM) sText);
int iCur = SendMessage(clientHandle, LB_GETCOUNT, 0,0);
SendMessage(clientHandle, LB_SETCURSEL , iCur-1, (LPARAM) 0);
......
}
I have a C# client that has a list box on it. When I use AddItem, the
item is actually added in the listbox (I can see it). However, the
IistBox.Items.Count does not change (it is still 0) and if I try to use
something like
listbox.SelectedIndex = 0
or access the Items somehow, I get ArgumentOutOfRangeException
(because Items collection still shows no elements).
I tried different settings but with no success.
Any ideas?
Thanks.
Ivan