Posts: 42
Joined: Thu Feb 23, 2006 12:38 pm

Updating MFC from OnReadCompleteded

Thu Jan 08, 2009 2:48 pm


This is more of an MFC question but maybe someone can assist.

In Bluetools I see this line inside OnReadCompleted
// NOTE! MFC is not thread safe and we are called in a new thread.
// Updating controls can be unsafe

What I want to do is exactly this. I have a standard MFC dialog which I would like to change some basic text inside and I need to do this with a function call from OnReadCompleted.

When I do this however I get really strange behaivour. What is the correct approach to take here, I just want to update the dialog text.

Posts: 2319
Joined: Mon Jan 09, 2006 2:20 pm
Location: Sweden

RE: Updating MFC from OnReadCompleteded

Thu Jan 08, 2009 4:31 pm

You have to synchronize the update procedure.
Since it's regular MFC you should be able to use PostMessage to trigger an update.


Return to “BlueTools”