Click here to Skip to main content
15,913,685 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralPopup menu question Pin
Cedric Moonen11-Aug-03 22:06
Cedric Moonen11-Aug-03 22:06 
GeneralRe: Popup menu question Pin
HPSI11-Aug-03 22:25
HPSI11-Aug-03 22:25 
GeneralRe: Popup menu question Pin
Cedric Moonen11-Aug-03 22:46
Cedric Moonen11-Aug-03 22:46 
Generallanguage classes for VC++6.0 Pin
Andrei Druta11-Aug-03 22:02
Andrei Druta11-Aug-03 22:02 
GeneralRe: language classes for VC++6.0 Pin
Steve S12-Aug-03 0:37
Steve S12-Aug-03 0:37 
GeneralRe: language classes for VC++6.0 Pin
Andrei Druta12-Aug-03 2:31
Andrei Druta12-Aug-03 2:31 
GeneralRe: language classes for VC++6.0 Pin
David Crow12-Aug-03 4:25
David Crow12-Aug-03 4:25 
GeneralRe: language classes for VC++6.0 Pin
YaronNir12-Aug-03 1:21
YaronNir12-Aug-03 1:21 
Hi,

There is an excellent built in utility in VC++. here are the steps:

1) Create a uni-code file (use note-pad and save as uni-code for encoding option) save it with the extention *.mc
2) At the top of the file write the following code:

MessageIdTypedef=DWORD
LanguageNames=(
Russian=0x019:MSG00019
Hebrew=0x40d:MSG0040d
)

"Russian" and "Hebrew" are just for the example, search MSDN or developer sites (or use Visual Assist) to find out the code for the languages you need.

3) Each control that represents text (i.e a static text) must not be hard coded english, it should load its text dynamically using
m_pMyControl->SetWindowText(......) , m_pMyControl is the handler to the control.
Now i will explain how to fill the ...... in the SetWindowText

4) in the uni code file *.mc you will now add defines that will represent your desired text, add the following code in the *.mc file:

MessageId=
SymbolicName=IDSL_EDIT_BOX_CONTROL_MAIN_MESSAGE
Language=English
Your english text here
.
Language=Russian
bla bla in russian
.
Language=Hebrew
bla bla in hebrew
.

make sure you end the section with new line (press enter after the '.' at the end of the section otherwise it would compile correctly).

4) add the *.mc file to your project.
5) right click it and choose compile
6) notice after compilation a header file called Strings.h was generated.
7) now when ever you need the 'SetWindowText', make sure you have a
#include "Strings.h" and use the SetWindowText() method as follows:


USHORT uLang = 0x009; // English
// uLang = 0x019; // Russian
// uLang = 0x40d; // Hebrew

CString szMsg;
LPVOID lpMsgBuf;
DWORD n;

n = ::FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_HMODULE |
FORMAT_MESSAGE_IGNORE_INSERTS,
AfxGetInstanceHandle(),
uID,
MAKELANGID(uLang , SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf,
0,
NULL);
szMsg = (LPCTSTR)lpMsgBuf;
m_pMyControl->SetWindowText(szMsg);

now the control will show the proper text in the desired language....

hope this helps ya

Yaron

Ask not what your application can do for you,
Ask what you can do for your application
GeneralRe: language classes for VC++6.0 Pin
Andrei Druta12-Aug-03 2:33
Andrei Druta12-Aug-03 2:33 
GeneralDrawing on DialogBox Pin
El'Cachubrey11-Aug-03 21:57
El'Cachubrey11-Aug-03 21:57 
Generalnonblocking server and FD_WRITE Pin
Rickard Andersson2011-Aug-03 21:03
Rickard Andersson2011-Aug-03 21:03 
GeneralRe: nonblocking server and FD_WRITE Pin
geo_m11-Aug-03 22:29
geo_m11-Aug-03 22:29 
GeneralRe: nonblocking server and FD_WRITE Pin
Rickard Andersson2011-Aug-03 22:44
Rickard Andersson2011-Aug-03 22:44 
GeneralRe: nonblocking server and FD_WRITE Pin
geo_m12-Aug-03 0:53
geo_m12-Aug-03 0:53 
GeneralRe: nonblocking server and FD_WRITE Pin
Jörgen Sigvardsson12-Aug-03 13:43
Jörgen Sigvardsson12-Aug-03 13:43 
GeneralRe: nonblocking server and FD_WRITE Pin
Rickard Andersson2012-Aug-03 20:58
Rickard Andersson2012-Aug-03 20:58 
GeneralRe: nonblocking server and FD_WRITE Pin
Jörgen Sigvardsson12-Aug-03 22:16
Jörgen Sigvardsson12-Aug-03 22:16 
GeneralRe: nonblocking server and FD_WRITE Pin
Rickard Andersson2012-Aug-03 23:00
Rickard Andersson2012-Aug-03 23:00 
GeneralRe: nonblocking server and FD_WRITE Pin
Jörgen Sigvardsson12-Aug-03 23:02
Jörgen Sigvardsson12-Aug-03 23:02 
GeneralKeyBoard & Mouse hooking Pin
WzR11-Aug-03 20:27
WzR11-Aug-03 20:27 
GeneralRe: KeyBoard & Mouse hooking Pin
Rage11-Aug-03 21:19
professionalRage11-Aug-03 21:19 
GeneralMFC DLL Distribution Question Pin
John Clump11-Aug-03 19:34
John Clump11-Aug-03 19:34 
GeneralRe: MFC DLL Distribution Question Pin
HPSI11-Aug-03 20:02
HPSI11-Aug-03 20:02 
GeneralRe: MFC DLL Distribution Question Pin
David Crow12-Aug-03 4:27
David Crow12-Aug-03 4:27 
Generalviewing an MS-Access Report without MS-Access Pin
sagmam11-Aug-03 18:59
sagmam11-Aug-03 18:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.