How to access UI elements from a thread?
Since the MFC is not thread-safe at object level (only at class level) one have to be careful when UI elements (like edit controls, listboxes etc.) should be accessed from inside the thread. The safest way is to pass a windows object handle and uses this inside the thread to post messages to the object. The following sample shows this technique assuming that the created dialog contains a static text control named ‘IDC_THREAD_TEXT’. The object handle of the dialog will be passed to the thread. Inside the thread this handle will be used to post ten messages to the dialog causing it to update the static control.
Related Questions
- In a UI file I have two <menu> elements, and the menu items inside the second <menu> do not show up in the application. Whats wrong?
- I heard that the FCC was changing the exam question pool for several Elements. When are the question pools changing?
- Are the UI elements in SpatialKey available as individual components that I can build into another application?