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

  • IBM Worklight is a mobile application development platform that lets you extend your business to mobile devices. It is designed to provide an open, comprehensive platform to build, run and manage HTML5, hybrid and native mobile apps.

  • In support of their business continuity and disaster recovery plans, many midsized companies endeavor to avoid putting all their eggs in one basket. Understanding the critical role of last-mile connectivity and always available Internet access for their enterprises, savvy firms utilize redundant connections from multiple service providers. Despite the good intentions, their Internet connectivity risk may still be in a single basket. That is because internet service providers (ISPs) and competitive local …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds