Using a pure resource DLL file to implement multilingual menu, interface text, tooltips, etc.

zhaozj2021-02-16  33

When using the VC written simply general program, universal is universal when the text of the implementation menu, interface, tooltips, etc. If you write a set of simplifications and traditional programs, it is definitely unrealistic. Find all information and articles can only implement the multi-language of the menu, and it is not convenient to use; and you cannot implement the interface, Tooltips, etc. Multi-language. Thus, a multilingual is implemented using a pure resource DLL file.

The pure resource DLL file implementation steps are as follows:

(1) After Creating a Simple Body MDI or SDI program, use files such as .rc, .rc2, .ico, .rc, .rc2, .ico, .bmp from the program framework;

(2) Use Projects Win32 Dynamic-Link Library to create a simple inferior resource DLL file, add .rc, .rc2, .ico, .rc, .rc2, .ico, .bmp, other files such as MDI or SDI program;

(3) Select Settings in the Project menu item and select Project Settings for the Link tab; then enter / nontry in the Project Options box. After compiling, a pure resource DLL file is generated;

The pure resource DLL file is added to the MDI or SDI program without any resource, which steps are as follows:

(1) Define protected Hinstance type variables (such as: MHINSTMENU) in the main application class .h file;

(2) Add the following code from the .CPP file :: InitInstance () function procedure:

MHINSTMENU = :: loadLibrary ("menu.dll"); // menu.dll is a DLL file for multilingual pure resources

IF (MHINSTMENU == NULL)

{

Return false; // failed to load the localized resources

}

Else {

AFXSetResourceHandle (M_HINSTMENU); // Get Resources from the DLL

} (3) Add the following code during the .CPP file :: exitInstance () function procedure:

Freelibrary (MHINSTMENU);

Note: Menu.dll files can have three placement methods: a, and .exe files under the same path; b, place below the Windows98 System or Windows2000's System32 path; c, place below the path set by PATH.

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

New Post(0)