Solved

Tri-lingual project.

Posted on 2000-05-04
6
234 Views
Last Modified: 2012-05-04
Hello,
This is what I have done so far:
Create a new project.
W32 Dynamaic Link Library (Project Name: ChineseRes.dll). A simple dll project. Finish.

Then, I copied all these from my program(which is in English) files over to the ChineseRes.dll directory.
a. Res directory
b. All my bitmaps
c. Resource.h
d. Itss.rc

Then in my ChineseRes.dll project, I included the Itss.rc file. After that, I open up all the dialog boxes and change the interface to the language I desire, which is Chinese and save and compile the simple dll project.

After that, I copied the dll that has already been compiled to my Windows/System directory.

In my actual program(the existing one, which is in English), I did some alterations to the code, as in what "proskig" told me to do, which is:

I add an HINSTANCE member variable to the application's CWinApp derived class.
HINSTANCE m_hChineseResDLL;

Then,
CWinApp::InitInstance definition:
m_hChineseResDLL=LoadLibrary("ChineseRes.dll");
ASSERT(m_hChineseResDLL !=NULL);
AfxSetResourceHandle(m_hChineseResDLL);

After that,
int CMyApp::ExitInstance()
{
  FreeLibrary(m_hChineseResDLL);
  return CWinApp::ExitInstance();
}

OK, that is a bit long story there.

Anyway, there is just one big problem. How about the MessageBox? How do I change the language in the message box itself, since it is only found in the code not in the resource file or in the string table.

I tried this method, which is: I made another copy of my actual program, and I changed the UI one by one and entered all the text in the messagebox to the string table and replaced the AfxMessageBox("Just a message");
to
AfxMessageBox(61447);
where 61447 is the value from the string table. Is that the correct way of doing?

And, how about the language from the
SetWindowsText? Can I use the same method as in the AfxMessageBox?
object.SetWindowsText(61447). But, this does not work.

Please help. Can you show me a correct way of doing this. The way I used is a little weird, isn't it?

Thank you.

If you do not understand what I have written here, I can be contacted at:
cheeonn@yahoo.com

Please help. I have until somewhere third week of May to complete this assignment. I know, all these multilingual stuff takes a really really long time to complete.


0
Comment
Question by:cheeonn
  • 3
  • 2
6 Comments
 
LVL 22

Expert Comment

by:CJ_S
ID: 2776585
I don't exactly see what ya wanna do, but try MAKEINTRESOURCE(61447)
0
 

Author Comment

by:cheeonn
ID: 2776617
Is that the way to put the SetWindowText message in the resource file?
But, how do I go about doing that? Where do I put the MAKEINTRESOURCE(61447)?
Thank you.
0
 
LVL 22

Accepted Solution

by:
CJ_S earned 23 total points
ID: 2776671
SetWuindowText needs a HWND, with MAKEINTRESOURCE you get a resource type returned.

Anywhere where you put the integer, you put the MAKEINTRESOURCE
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Expert Comment

by:ewie2k
ID: 2778573
You will need the LoadString API:

int LoadString(

    HINSTANCE  hInstance,      // handle of module containing string resource
    UINT  uID,      // resource identifier
    LPTSTR  lpBuffer,      // address of buffer for resource
    int  nBufferMax       // size of buffer
   );

lpBuffer

Points to the buffer to receive the string.

nBufferMax

Specifies the size of the buffer in bytes (ANSI version) or characters (Unicode version). The string is truncated and null terminated if it is longer than the number of characters specified.

ex:

LoadString(m_hChineseResDLL, MAKEINTRESOURCE(61447), lpbuffer, buffermax);
AfxMessageBox(lpbuffer);

Replace lpbuffer and buffermax with arguments you find appropriate. This should solve your problem.
0
 

Author Comment

by:cheeonn
ID: 2809367
Adjusted points from 20 to 23
0
 

Author Comment

by:cheeonn
ID: 2809368
Thank you for the guidance. I have completeted the project successfully.
Thank you so much.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question