Results 1 to 5 of 5

Thread: Threads and Objects

  1. #1

    Thread Starter
    Hyperactive Member noble's Avatar
    Join Date
    Nov 2000
    Location
    Philly
    Posts
    471

    Threads and Objects

    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.
    Bababooey
    Tatatoothy
    Mamamonkey

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Is this just a control in your window/dialogue, or do you mean an actual MFC wrapper object?
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3

    Thread Starter
    Hyperactive Member noble's Avatar
    Join Date
    Nov 2000
    Location
    Philly
    Posts
    471
    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....
    Bababooey
    Tatatoothy
    Mamamonkey

  4. #4

    Thread Starter
    Hyperactive Member noble's Avatar
    Join Date
    Nov 2000
    Location
    Philly
    Posts
    471
    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
    Bababooey
    Tatatoothy
    Mamamonkey

  5. #5
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    CListView view;
    view.Attach(hwnd);

    view.GetControl().Whatever();

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

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width