Click here to Skip to main content
Licence CPOL
First Posted 30 Jul 2008
Views 9,602
Bookmarked 7 times

Working with Unicode and MSLU - Common Problems

By | 30 Jul 2008 | Article
The following description briefs you on common problems you might come across while working with MSLU (Microsoft Layer for Unicode)

Introduction

The articles describes some of the common issues you'd come across while working with MSLU using MFC/Win32.

Background

Creating Unicode applications has always been an encouraging factor for developer and the users. However, the problem is the difficulty in supporting a Unicode application on Non-Unicode Windows Operating Systems (Windows 95/98/ME); developers had to support those customers as well. Because these platforms were not intended to support Unicode, which was introduced by the NT family of operating systems, the fallback was to write non-Unicode applications.

I have attempted to put across some of the common problems you would encounter, and how you can tackle them.

Working with MSLU — Common Problems

  1. The CListCtrl controls in your application might not display the contents properly. this can happen with some other common windows controls. This is due to the fact that control notifications format for Unicode needs to be set specifically. We handled the WM_NOTIFYFORMAT message and explicitly return NFR_UNICODE for UNICODE configurations and returns NFR_ANSI for Non-UNICODE configurations.

    LRESULT CSampleDlg :: OnNotifyFormat(WPARAM wParam, LPARAM lParam)
    {
    #ifdef _UNICODE
        return NFR_UNICODE;
    #else
        return NFR_ANSI;
    #endif
    }
  2. On Windows 98/ME, CRichEditCtrl doesn’t show the Unicode text, as it uses version 1.0 of CRichEditCtrl (window class RICHEDIT). The solution is to use version 2.0 (window class RICHEDIT20W). Changed the .rc file (resource script), so that "IDC_RICHEDIT_..." to refer to "RICHEDIT20W" class instead of "RICHEDIT".... Thats all....

  3. On Windows 98 system, another issue was, we were not able to get the tool tips for some of the controls. This also needs NOTIFYFORMAT to be handled as described in point
  4. Another problem is with the use of Set/GetMenuString and Set/GetMenuItemInfo functions on windows 98 system. This happens as the GetMenuItemInfoW function sometimes returns ANSI strings rather than Unicode ones. The workaround is to either use the GetMenuItemInfoA function or to use the MSLU GetMenuStringW function, which will work properly here. An error affecting InsertMenuItemW and SetMenuItemW was fixed at the same time (the MENUITEMINFO.cch member was being used to get the string length even though setting it is not required in those APIs).

References

History

Version 1.0 --- 30/Jul/2008

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

saud_ad

Web Developer

India India

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralMy vote of 1 Pinmemberauge__5:22 22 Mar '10  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120517.1 | Last Updated 30 Jul 2008
Article Copyright 2008 by saud_ad
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid