Under what circumstances will a dialog box not use the caption specified in the resource file?

Raymond Chen

Raymond

Could it be space aliens?

Under what circumstances will a dialog box not use the caption specified in the resource file? In particular, we have a modal dialog box that is not using the caption from the resource file. Even if we explicitly call Set­Window­Text from within the WM_INIT­DIALOG handler, the call succeeds but the caption remains unchanged.

The dialog box’s initial title is the value specified in the resource template. And if you set it again in the WM_INIT­DIALOG handler, then that new title overwrites the title from the resource template. Perhaps the problem is that some other code that runs after your WM_INIT­DIALOG handler is changing the title yet again.

The customer sheepishly wrote back,

[banging head against the wall]

Being skeptical that there could ever be anything else overwriting the code I went to debug with Spy++. After some considerable effort I found out that yes, further down ~30 lines there’s a call to Set­Window­Text that changes the title to something else.

Thanks for making me look again.

Sometimes the fault is not in our stars but in ourselves.

Raymond Chen
Raymond Chen

Follow Raymond   

0 comments

Comments are closed.