PDA

Click to See Complete Forum and Search --> : Threads and Objects


noble
Jun 25th, 2002, 11:45 AM
what is the best way to access a ListCtrl from within a worker
thread?

I'm aware of the object over thread boundaries dilemma and
its possible catastrophic results.

parksie
Jun 25th, 2002, 01:54 PM
Is this just a control in your window/dialogue, or do you mean an actual MFC wrapper object?

noble
Jun 25th, 2002, 07:48 PM
it's in a window
i want a worker thread to manage parts of the list when i say to
instead of the app stalling everytime i make intensive changes
to the list.

what i did so far was passed the Thread function the hWnd of
my CListView and attached it to a window.

the problem is i created a pointer of type CWnd and used the
hWnd i passed from the View.....how do i access the ListCtrl
from the CWnd pointer now?

I'm not sure if i have to cast it, or create a CView pointer from
the hWnd i passed it....

noble
Jun 25th, 2002, 08:02 PM
i also tried to create a static member function within my CListView
derived class.... i obviously can not get at the listctrl from there
either

CornedBee
Jul 10th, 2002, 11:24 AM
CListView view;
view.Attach(hwnd);

view.GetControl().Whatever();

I think it was GetControl(), but I'm not sure. This should work.