Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Threading [modified]-pls help me its very urgent

Threading [modified]-pls help me its very urgent

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    deeps_cute
    wrote on last edited by
    #1

    hi i am calling a thread in onintdialog of my mfc app. the thread inturn calls a funciton which perform an inifinte loop. this infinite loop will read a file continously and display the result in the list box. when i select the item in list box it takes time to call the function inside the item seelcted. this is because of the infinite loop. what to do for this? pls help me -- modified at 6:55 Monday 11th June, 2007

    Arise Awake Stop Not Till ur Goal is Reached.

    C 1 Reply Last reply
    0
    • D deeps_cute

      hi i am calling a thread in onintdialog of my mfc app. the thread inturn calls a funciton which perform an inifinte loop. this infinite loop will read a file continously and display the result in the list box. when i select the item in list box it takes time to call the function inside the item seelcted. this is because of the infinite loop. what to do for this? pls help me -- modified at 6:55 Monday 11th June, 2007

      Arise Awake Stop Not Till ur Goal is Reached.

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      deeps_cute wrote:

      when i select the item in list box it takes time to call the function inside the item seelcted. this is because of the infinite loop.

      :confused: What do you mean ? What is this function you are calling ? And why does it take time ? BTW, it is generally better not to work on GUI classes from another thread. For example: add strings in your list box from another thread. It is better to send a message from your thread to the window that manages the list box.


      Cédric Moonen Software developer
      Charting control [v1.2]

      D 1 Reply Last reply
      0
      • C Cedric Moonen

        deeps_cute wrote:

        when i select the item in list box it takes time to call the function inside the item seelcted. this is because of the infinite loop.

        :confused: What do you mean ? What is this function you are calling ? And why does it take time ? BTW, it is generally better not to work on GUI classes from another thread. For example: add strings in your list box from another thread. It is better to send a message from your thread to the window that manages the list box.


        Cédric Moonen Software developer
        Charting control [v1.2]

        D Offline
        D Offline
        deeps_cute
        wrote on last edited by
        #3

        see i have to list some items (read from a file say list.txt) in a list control. the file list.txt is changeble everytime. hence i used a infinite a loop to read the file and updated it to the list box using threading. when i select the items in list box it takes several time to focus the selected item. i tried with sending a message also. but it does not work. what i have to do?

        Arise Awake Stop Not Till ur Goal is Reached.

        D 1 Reply Last reply
        0
        • D deeps_cute

          see i have to list some items (read from a file say list.txt) in a list control. the file list.txt is changeble everytime. hence i used a infinite a loop to read the file and updated it to the list box using threading. when i select the items in list box it takes several time to focus the selected item. i tried with sending a message also. but it does not work. what i have to do?

          Arise Awake Stop Not Till ur Goal is Reached.

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          deeps_cute wrote:

          hence i used a infinite a loop to read the file...

          Instead of wasting CPU cycles polling the file, why not let the OS notify you that the file has been changed? BTW, you might want to wait longer than 2 hours before re-posting your question in order to give everyone a chance to read it.


          "A good athlete is the result of a good and worthy opponent." - David Crow

          "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups