Microsoft KB Archive/832187

= BUG: An unexpected resource language change occurs with non-English language operating systems when you use an MFC class library as a static link library in Visual C++ .NET =

Article ID: 832187

Article Last Modified on 1/5/2006

-

APPLIES TO


 * Microsoft Visual C++ .NET 2003 Standard Edition
 * Microsoft Visual C++ .NET 2002 Standard Edition

-





SYMPTOMS
When you use a Microsoft Foundation Classes (MFC) class library as an MFC static library instead of as an MFC shared-dynamic link library (DLL) in an MFC program, a problem occurs with an unexpected change in the resource language. This unexpected change in the resource language occurs on a computer that has a non-English language operating system, such as a Japanese language operating system or a Chinese language operating system. The resource language changes to English although the language of the operating system is not English.



CAUSE
When you use an MFC static library, Microsoft Visual C++ .NET interprets the resource language as English instead of the language of the operating system that may be the Japanese language or the Chinese language. The resource language is not localized when the MFC class library is used in the form of an MFC static library. This problem occurs because the directory paths in the application resource file (.rc) are missing. When you create an MFC application by using Visual C++ .NET, the directory path (l. ) to the afxres.rc file and to the afxprint.rc file are omitted from the resource file (.rc) file.

Note In this article,  is a placeholder for the language short name. If you use the Japanese language, the placeholder must contain. If you use the German language, the placeholder must contain. If you use the Chinese language, the placeholder must contain.



WORKAROUND
To work around this problem, you must edit the resource file (.rc) manually. You must put the missing directory path (l. ) in the resource file. The directory path denotes the language of the resources that must be used in the path of the afxres.rc file and in the path of the afxprint.rc file. You must include the directory path in all the occurrences of the afxres.rc file and in all occurrences of the afxprint.rc file.

For example, if you use the Japanese language, follow these steps:  Start Notepad or another text editor. Open the resource file (.rc) of the MFCProject project in the editor.  Search for all the occurrences of the following string in the resource file: afxres.rc Replace this string with the following string: l.jpn\\afxres.rc   Search for all the occurrences of the following string in the resource file: afxprint.rc Replace this string with the following string: l.jpn\\afxprint.rc  Save the resource (.rc) file. Open the MFCProject project in Microsoft Visual Studio .NET.</li> Press CTRL+SHIFT+B to build the solution.</li></ol>

Note For example, If you use the Chinese language, you must replace the afxres.rc string and the afxprint.rc string with the l.chs\\afxres.rc string and the l.chs\\afxprint.rc string, respectively. You replace these strings in the resource file. You must change the language short name in the same manner for other languages.

You must build the solution again for the changes in the resource file to be effective.

<div class="status_section">

STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

<div class="moreinformation_section">

Steps to reproduce the problem

 * 1) Start Visual Studio .NET 2002 or Visual Studio .NET 2003 on a computer that has a Japanese language operating system or a Chinese language operating system installed.
 * 2) On the File menu, point to New, and then click Project.
 * 3) Under Project Types, click Visual C++ Projects, and then click MFC Application under Templates.
 * 4) In the Name text box, type MFCProject.
 * 5) In the Location text box, type C:\Test, and then click OK.
 * 6) In the MFC Application Wizard - MFCProject dialog box, click Application Type.
 * 7) Under Application type, click Single document.
 * 8) Verify that theResource Language is not English, but is the language of the operating system that you are using.

By default, the operating system language is selected as the Resource Language. In this case it is either Japanese or Chinese.
 * 1) Click Finish to close the MFC Application Wizard - MFCProject dialog box.
 * 2) Press CTRL+SHIFT+B to build the project.
 * 3) Press CTRL+F5 to run the program.

Notice that the title of the application appears in the same language as the language of the operating system that you are using.
 * 1) Close the application window.
 * 2) In Solution Explorer, right-click the MFCProject node, and then click Properties.
 * 3) In the MFCProject Property Pages dialog box, expand the Configuration Properties folder, and then click General.
 * 4) Under the Use of MFC property, change Use MFC in a Shared DLL to Use MFC in a Static Library.

Note By default, the MFC application uses the MFC class library in the form of a shared DLL.
 * 1) Click Apply, and then click OK.
 * 2) Press CTRL+SHIFT+B to build the project.
 * 3) Press CTRL+F5 to run the program.

The title of the application window appears in the English language instead of the non-English language of operating system that you are using.

Keywords: kbbug kbresource kblocalization kbdlg KB832187

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.