Replacing texts “OK”, “Cancel”, “Apply” and “Help”

2019-08-19 08:03发布

On a Win32 property sheet the texts "OK", "Cancel", "Apply" and "Help" are automatically displayed in the system's language. That can be a problem if the language of a Software is different of the system's language.

For instance if a customer installs the French version of our software on an English Windows, the property sheet's content will be in French but the standard buttons at the bottom of the property sheet will be in English not matter what.

Does anybody know how can I change these texts.

标签: winapi mfc
1条回答
我欲成王,谁敢阻挡
2楼-- · 2019-08-19 08:48

Actually changing these texts is quite simple. The only thing that must be done is to derive a class from CPropertySheet, override the OnInitDialog method and change the texts in the overridden OnInitDialog.

class CMyPropertySheet : public CPropertySheet
{
public :
  CMyPropertySheet() ;

protected:
  virtual BOOL OnInitDialog();

  DECLARE_MESSAGE_MAP()
} ;

BOOL CMyPropertySheet::OnInitDialog()
{
  ...
  SetDlgItemText(IDOK, whatever..) ;
  SetDlgItemText(0x3021, whatever..) ;   // 0x3021 == IDAPPLY
  SetDlgItemText(IDCANCEL, whatever...) ;
  SetDlgItemText(IDHELP, whatever...) ;
}
查看更多
登录 后发表回答