Native titlebar name not always changing


The titlebar, when using a native window, doesn’t always change when setting the window component’s name.

You can quite easily see it in the new Jucer. If you fire up the actual Jucer’s jucer project, just step through the items in the left panel. SOME of the item names appear in the title bar, and some don’t. It’s quite strange because it seems to always be the same ones that do/don’t [suggesting that it’s actually the content of the string that determines whether it will work or not].

I’m using win7 64, so not sure if this happens in anything else…

EDIT: latest tip :slight_smile:


Wow. That’s a great bug!

(This is also the same bug that the ASIO guys were having over on another thread)

Had me bamboozled for a while, because when you trace what’s happening, you can watch the string being correctly converted to utf-16, and then the correct pointer to this string gets passed into SetWindowText, and then… nothing happens!

After a bit of head-scratching, I noticed that it was failing when the utf-16 pointer is aligned on an odd memory address, which will happen when the original string contains an even number of character (because the string class just tacks the utf-16 version on the end). I’ve no idea why the win32 functions would care about the byte alignment, but it seems that they do - at least it’s an easy fix, will get something checked in shortly!


:smiley: yeah, it did strike me as a potential symptom of some sneaky lurking String-related win32 issue. Well done for figuring it out so quickly! :slight_smile: