Let's describe my question as below:
I have created a window using
CreateWindow
, and then also created aListview
and EDIT box to show something;hListview
is the handle of the Listview andhEdit
is the handle of EDIT boxFor now, my program is a single-threaded app;
I have 2 functions void
SetListviewText()
: to assign different value toListview
's specified item and subitem (theListview
is in report mode);and
void SetEditBoxText()
: to append some text to EDIT box, of course, both of them were updated withSendMessage();
example,
SetEditBoxText(hEdit, "1111111111111111111111111111111."); SetListviewText(hListview, "Description1",19); Sleep(1000); SetEditBoxText(hEdit, "2222222222222222222222222222222"); SetListviewText(hListview, "Description2",20); SetEditBoxText(hEdit, "33333333333333333333"); Sleep(5000);
question,
why I only can get the EDIT box content as:
111111 (
Listview
text not update now).......1second delay.........
2222222222222(
Listview
text not update now)3333333333333333(
Listview
text not update now).......5seconds delay.........
(
Listview
text update eventually after 6seconds..)Description1
Description2
Why can't the Listview's text be updated together with EDIT box?
PS: If I only put below code in button click case, it's OK to show it immediately.
SetListviewText(hListview, "Description2",20);
Should I use multiple threads? If yes, how?
Thanks in advance.