MFC dialogs caption fails with Unicode

222 Views Asked by At

I am trying to use Win32 functions like MessageBox or GetOpenFileName in Unicode mode but the caption always shows ??????????????. I have resources in different languages like Chinese or Hindi and all works well except for standard dialog functions.

I do use the W version, and I have tried it in both MBCS and Unicode linked libraries with no success. I can build my own MessageBoxW, but can't afford rewriting file or folder pick functions.

The typical call is as simple as: enter image description here

Note the title is conveniently defined in Unicode with some Hindi characters. This can be seen with the debugger on the ofn structure: enter image description here

But the dialog caption does not show the Hindi string enter image description here

The dialog behind shows the right strings, in Hindi and Chinese besides latin characters, and it is built with the old Win32 dialog calls in a MBCS linked DLL. See though the comment below.

The front dialog is built in Unicode MFC linked DLL.

The odd thing is that normal dialogs built with Win32 or with MFC fail the same way with SetWindowTextW on the dialog handle. SetWindowTextW works fine on dialog items, and SetDlgItemTextW, works fine too. It is the dialog caption that does not work.

I found, though, a workaround: Instead of SetWindowTextW I use DefWindowProcW. enter image description here

Hasn't anyone stumbled into this before ???

0

There are 0 best solutions below