Threading [modified]-pls help me its very urgent
-
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.
-
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.
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] -
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]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.
-
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.
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