私はANSIプロジェクトを持っています。 CDialogの派生クラスのタイトルバーをUnicodeテキストに設定する必要があります。ANSIプロジェクトのSetWindowTextW
BOOL CMyDialog::OnInitDialog()
{
CDialog::OnInitDialog();
::SetWindowTextW(GetSafeHwnd(), PathFindFileNameW(filename));
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
ただし、UnicodeテキストにANSI以外の文字が含まれている場合は、疑問符で表示されます。私は "?????。doc"のようなものを手に入れます。静的コントロールにも同様の問題がありますが、不思議なことに、エディットボックスSetWindowTextWが機能します。
ああ、このプロジェクトは、ユニコードに変換できない大きなレガシープロジェクトです。
これらの関連する質問もご覧ください:http://stackoverflow.com/questions/4989820/win32-problem-with-unicode-in-an-edit-box and http://stackoverflow.com/questions/1322801/piecewise -conversion-of-an-mfc-app-to-unicode-mbcs –