Thank you very much, Mr Cvetanović .
Your answer is what I really need.
You mean UWM_UPDATE_LIST is a user-defined message, actually listcontrol and
the parent of listcontrol own the same message queue.
I also planned to send the WM_NOTIFY(LVN_INSERTITEM) message to the parent
dialog, but it is also not right solution.
About
---------------
If wParam and lParam should contain some structs or buffers (like char*)
then create them in worker thread, and delete them in event handler.
---------------
This is also what I'm thinking. If I don't create/new the struct or buffer
in the worker thread, but instead, use the stack, and post the address of
the struct as lParam or wParam to the UI. I'm afraid this will cause UI to
lose some results.
Am I right?
Also one of my colleague says, continuously "new" and "delete" will cause
many memory fragments. Is he right? If he is right, How should I avoid this?
Thank you.
"Mihajlo Cvetanović" wrote:
zhaoyandong wrote: So I have to use SendMessage(LVM_XXX, hListCtrl) in the worker thread, I
guess.
But I failed, there is nothing displaying in the list control in the UI
dialog.
Use PostMessage(hListCtrlParent, UWM_UPDATE_LIST, wParam, lParam) in the
worker thread, and SendMessage(hListCtrl, LVM_...) in the event handler
of user window message UWM_UPDATE_LIST. This might not solve your
problem, but it's the right thing to do.
If wParam and lParam should contain some structs or buffers (like char*)
then create them in worker thread, and delete them in event handler.