To implement multilingual support in VC6

zhaozj2021-02-16  57

To implement multilingual support in VC6

Zhang Zhigang

2004

Year 6

Monthly

day

With the popularity of computers in various industries, and the development of my country's software industry, domestic software is constantly moving out of the country, so many multilingual supports of various software have also been concerned about more and more programmers. For a software program to support different languages, creating different source transactions is obviously not a good way. This article mainly describes how to implement multi-language support by creating a multilingual resource file in a VC6 environment.

First create an engineering item TEST that supports Simplified Chinese, and uses the INSERT COPY command to create a resource item that supports English using the INSERT COPY command;

Open the .rc file of the project, rewrish the 3 textinclude discardable part of the file to:

3 TEXTINCLUDE DISCARDABLE

Begin

"#define _afx_no_splitter_resources / r / n"

"#define _afx_no_ole_resources / r / n"

"#define _afx_no_tracker_resources / r / n"

"#define _afx_no_property_Resources / R / N"

"/ r / n"

"#if! defined (AFX_RESOURCE_DLL) || Defined (AFX_TARG_CHS) / R / N"

"#ifdef _win32 / r / n"

"Language 4, 2 / R / N"

"#pragma code_page (936) / r / n"

"#ndif // _ win32 / r / n"

"#include" "RES // TEST.RC2" "// Non-Microsoft Visual C Edited Resources / R / N"

"#include" "L.chs // AfXRES.RC" "// Standard Components / R / N"

"# Endif / R / N"

"#if! defined (afX_RESOURCE_DLL) || defined (afx_targ_enu) / r / n"

"#ifdef _win32 / r / n"

"Language 9, 1 / R / N"

"#pragma code_page (1252) / r / n"

"#ndif // _ win32 / r / n"

"#include" "" RES // Test .rc2 "" // Non-Microsoft Visual C Edited Resources / R / N "

"#include" "AfXRES.RC" "// Standard Components / R / N"

"# Endif / R / N"

"/ 0"

End

The generated from the textinclude 3 resource at the end of the file is rewritten as:

#define _AFX_NO_SPLITTER_RESOURCES

#define _AFX_NO_OLE_RESOURCES

#define _AFX_NO_TRACKER_RESOURCES

#define _AFX_NO_PROPERTY_RESOURCES

#if! defined (AFX_RESOURCE_DLL) || Defined (AFX_TARG_CHS)

#ifdef _win32

Language 4, 2

#pragma code_page (936) #ENDIF / / _ WIN32

#include "res / phtools.rc2" // Non-Microsoft Visual C Edited Resources

#include "l.chs / afxres.rc" // standard Components

#ENDIF

#if! defined (AFX_RESOURCE_DLL) || Defined (AFX_TARG_ENU)

#ifdef _win32

Language 9, 1

#pragma code_page (1252)

#ENDIF / / / WIN32

#include "res / phtools.rc2" // Non-Microsoft Visual C Edited Resources

#include "afxres.rc" // standard components

#ENDIF

Such a resource of the project can support Chinese and English. From the Project menu, select the setting ... option, open the Project Settings dialog, select the Resources tab, add ", afx_targ_enu, afx_resource_dll", AFX_TARG_ENU, AFX_RESOURCE_DLL, to generate a program that supports English, if not ", afx_targ_enu , AFX_Resource_dll ", compiling the project to generate a program that supports Chinese.

转载请注明原文地址:https://www.9cbs.com/read-18355.html

New Post(0)