Thanks for ur reply, But all the things jumped over my head. VC++ is really
a tough thing.
I have figured out one way to do this. It is as
LV_DISPINFO* pDispInfo = (LV_DISPINFO*) NMHDR;
int nPos = pDispInfo->item.iItem ;
POSITION Pos = m_List1.GetFirstSelectedItemPosition();
CString ListText = m_List1.GetItemText((int)Pos - 1, nPos);
I am able to fetch the fetch the selected Item in ListText . But Iam not
sure whether it is a gud process to do the things. If u hav a better one
don't hesitate to write it down.
Thanks
Vijay
"William DePalo [MVP VC++]" <wi***********@mvps.org> wrote in message
news:u6**************@TK2MSFTNGP11.phx.gbl...
"Vijay" <he**********@yahoo.com> wrote in message
news:OK**************@TK2MSFTNGP12.phx.gbl... Iam new to VC++6.0.
Glad to have you among us but ....
... that tool is 6 or so years old.
I want to display selected item of the ListBox in a MessageBox.
Send the listbox a WM_GETCURSEL message. That will get you the index into
the list of the currently selected item. If the result is 0xFFFFFFFF (-1
as a signed integer) then there is no selection. Then you send a
LB_GETTEXTLEN using the index of the item to get the length of the string.
Then you insure that you have a buffer at least one character larger (for
the trailing 0 byte). Finally you send a LB_GETTEXT message to fetch the
text into the buffer.
Moreover, If I want to insert any element at the mth place of nth col in
list box of type Report. can I achieve it.
Check the docs for the LB_INSERTSTRING message.
Regards,
Will