OK I have code that I'm trying to make work completely using PostMessage -- this is in a worker thread and it is possible (although exceedingly improbable in this particular case) that using SendMessage() to a window whose procedure is running in my main thread could cause a deadlock.
My problem is PostMessage with WM_SETTEXT does not work (the text of the control remains unaltered). If I use SendMessage, it works fine.
It's not a scope issue, the buffer whose address I'm passing remains allocated throughout the life of the program. And if that was the case, I would expect it to change the caption to some kind of garbage -- it's leaving it totally unchanged.
I suppose I could make a user-defined message, post it to my main window, and have my main thread call ::SetWindowText(), but it seems like it should be possible to make it work with just
::PostMessage(param->statusWnd,WM_SETTEXT,(WPARAM)0, (LPARAM) threadbuffer);
And as mentioned, simply changing PostMessage to SendMessage causes it to work as expected.