How about sending the data as part of the message you post to the UI? Especially as it's only one word of information:
LRESULT CContactFault::OnDeviceShortAddress(WPARAM, LPARAM lparam)
{
UINT data = reinterpret_cast<uint>(lparam);
CsLoader = _T("%d");
CsTmp.Format(CsLoader, data);
MapFP.WriteString(CsTmp + "\n");
return 1;
}
You'll have to remember to bung your worker's m_data in as the LPARAM in the call to Postmessage but it'll stop any synchronisation headaches.
Incidentally this trick also works if you have more data to post - allocate a structure, post the address of this to the UI. The UI can read the data and then delete the structure. Intercommunicating processes and asynchronous message transfer is one of the safest ways to do multi-threading around.
Cheers,
Ash
Edit as this effing editor loves "closing" tags I open when using C++ templates