Update dialog box from thread outside class

I need to access a dialog box from a thread outside of the dialog box class.

in portai.cpp, the thread is called like this:
m_pReaderThread = AfxBeginThread(ReaderThread, (LPVOID)this);

m_pReaderThread is declared like this in portai.h  CWinThread* m_pReaderThread;      
and the thread is declared as UINT CiPortAI::ReaderThread(LPVOID pThis)

I want to be able to update text boxes on my main dialog box from within the thread. How do I do this?
Who is Participating?
alb66Connect With a Mentor Commented:
I think the best solution is to pass the handle of the dialog to the thread. Then you can post some application defined message to the dialog in order to update the user interface.

cast LPVOID pThis to the class from which it was called ()pThis
apostrophe27Author Commented:

It worked, and I learned about worker threads. Thanks.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.