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

  • This paper introduces IBM Java on the IBM PowerLinux 7R2 server and describes IBM's implementation of the Java platform, which includes IBM's Java Virtual Machine and development toolkit.

  • Get Gartner's NEW Magic Quadrant for Solid-State Arrays. Selecting new storage or just researching? Simplify your vendor evaluation with Gartner's 2014 Magic Quadrant for Solid-State Arrays. This report covers: Strengths & cautions for 12 vendors Assessment of each vendor's completeness of vision and ability to execute Key criteria for evaluating Solid-State Array vendors

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds