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 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


Comments

  • RTL strings

    Posted by Legacy on 03/03/2003 12:00am

    Originally posted by: Deepak

    HI,

    Do you know how to display the Hebrew/Arabic Strings on a owner drawn button controls. I have string 23 x 15 mm, but when I call a ExtTextOut to display the above string, it comes as a inches mm 15 23 on a button control.
    DO you ever face this problem.

    Regards
    dk

    Reply
  • Can program run on Win98

    Posted by Legacy on 12/07/2001 12:00am

    Originally posted by: NGUYEN HUU HOA

    This code is only implement on Win2000 environment. Can it run on Win98?

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Today's agile organizations pose operations teams with a tremendous challenge: to deploy new releases to production immediately after development and testing is completed. To ensure that applications are deployed successfully, an automatic and transparent process is required. We refer to this process as Zero Touch Deployment™. This white paper reviews two approaches to Zero Touch Deployment--a script-based solution and a release automation platform. The article discusses how each can solve the key …

  • Learn How A Global Entertainment Company Saw a 448% ROI Every business today uses software to manage systems, deliver products, and empower employees to do their jobs. But software inevitably breaks, and when it does, businesses lose money -- in the form of dissatisfied customers, missed SLAs or lost productivity. PagerDuty, an operations performance platform, solves this problem by helping operations engineers and developers more effectively manage and resolve incidents across a company's global operations. …

Most Popular Programming Stories

More for Developers

RSS Feeds