Internationalizing menus using MFC support for Unicode | CodeGuru

Internationalizing menus using MFC support for Unicode

Environment: Windows 2000 This simple SDI Notepad-like application demonstrates how, taking advantage of the MFC support for Unicode, to Turkmenize labels of the specified menu items. Actually, Turkmen is not supported by Windows 2000, therefore, to create such resources as menu so that strings in Turkmen could be displayed I had to invent an additional […]

Written By
CodeGuru Staff
CodeGuru Staff
Jul 23, 2001
1 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

Environment: Windows 2000

This simple SDI Notepad-like application demonstrates how, taking advantage of the MFC support for Unicode, to Turkmenize labels of the specified menu items.
Actually, Turkmen is not supported by Windows 2000, therefore, to create such resources as menu so that strings
in Turkmen could be displayed I had to invent an additional technique.

void CMainFrame::ModifyMenu(CMenu* pMenu)
{
  UINT nPosition;
  UINT nCount;
  CString string;
  nCount = pMenu->GetMenuItemCount();
  for (nPosition = 0; nPosition < nCount; nPosition++)
  {
    pMenu->GetMenuString(nPosition,string,MF_BYPOSITION);
    if(string.IsEmpty())
      continue;
    string.Replace(SMALL_X, Small_S_cedilla[0]);
    string.Replace(CAPITAL_X, Capital_S_cedilla[0]);
    string.Replace(SMALL_Q, Capital_N_caron[0]);
    pMenu->ModifyMenu(nPosition,MF_BYPOSITION|MF_STRING,
      pMenu->GetMenuItemID(nPosition),string);
    //recursive call
    if(pMenu->GetSubMenu(nPosition))
      ModifyMenu(pMenu->GetSubMenu(nPosition));
  }
}

Downloads

Download demo project – 48 Kb

Download source – 288 Kb

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.