Adding multilanguage support to your application | CodeGuru

Adding multilanguage support to your application

Environment:VC6 SP3, NT4 SP4, Win98 Here is my way to change my App’s language. It is tested under both Win98 and NT( Win95 will be good also). It looks good, but It needs more steps. First, after you create you app, you should create a dll that contains all the resource of the application. the […]

Written By
CodeGuru Staff
CodeGuru Staff
Jul 3, 1999
2 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

Environment:VC6 SP3, NT4 SP4, Win98

Here is my way to change my App’s language. It is tested under both Win98 and NT( Win95 will be good also). It looks good, but It needs more steps.

First, after you create you app, you should create a dll that contains all the resource of the application. the same resource ID but different language. The best way is add a new workspace of dll into your app’s workspace, then drag and drop the resource. After doing that, modify the resource of the Dll to another language. This may take some time to do that.Complie and create the dll file.

The second is Modify you app source code.

In InitInstance( ) of your App class, before creating all windows or dialog, add code below:

(Japanese.dll is my resource dll file’s name)

…
HINSTANCE hJapaneseDll	//Global var
…..
CMultiLangApp::InitInstance()
{
……
	//Get Language Setting from INI
	uLanguage = GetProfileInt(“Language”, “Language”,0);
	if (uLanguage == 1)
	{
		//Language is set for Japanese.
		hJapaneseDll = AfxLoadLibrary(“Japanese.dll”);
		ASSERT(hJapaneseDll);
		AfxSetResourceHandle(hJapaneseDll);
	}
…..
	//create dialog or main frame
…..
}

Last, add a switch such like menus or radios to change settings of language, then the next time run the app, it will display the language your expected.

The core is function AfxSetResourceHandle(HINSTANCE), which changes the location to find the resource. The common dialog is based on the version of Windows. So I think that if you wanna create a real business international application, you should read the Register in InitInstance( ) to get the version of windows, then change to the appropriate language. This way can support as many languages as your like.

Because I create this sample under Japanese windows. So the sample’s language dll is japanese, I hope you can see it. The complier environment is VC6.0 SP3 ,WindowsNT 4.0 SP4 and Windows 98

Downloads

Download demo project – 74 KB

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.