okay, so I have a dialog box which is used as the main window for my app. for the dialog box's WM_INITDIALOG message I am creating a thread. the thread does some stuff, and then sends a message to a control on the dialog to adjust its font weight.
the problem seems to be that sometimes the message to adjust the font weight of the control is being sent before the WM_INITDIALOG message has been fully processed (before the dialog box appears). when this happens, the code to adjust the font weight doesn't work, I have to minimize and maximize the dialog box to see the change. this only happens sometimes, and depends on a number of factors, however I am 100% sure that this is the problem (I tried adding a MessageBox in the thread function before calling the function that adjusts the control's font weight, and found that the MessageBox sometimes appears before the dialog box does, and in these cases the font weight is not changed). the function that adjusts the control's font weight uses SendMessage, sending WM_SETFONT.
I've thought of adding a Sleep statement in my thread function, but that would be my last resort. basically I need a way to make sure that the function that changes the font weight is executed after the WM_INITDIALOG message has been fully processed, but I can't think of how I can do this.
any suggestions or advice here would be appreciated. thank you in advance.