【发布时间】:2012-03-13 17:14:41
【问题描述】:
我有一个 ANSI 项目。我需要将 CDialog 派生类的标题栏设置为 Unicode 文本。
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 可以工作。
哦,这个项目是一个大型遗留项目,无法转换为 Unicode。
【问题讨论】: