Click here to Skip to main content
15,904,024 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Re-Mssql question Pin
MsmVc21-Dec-09 21:56
MsmVc21-Dec-09 21:56 
QuestionRe: Re-Mssql question Pin
PCuong198321-Dec-09 21:58
professionalPCuong198321-Dec-09 21:58 
AnswerRe: Re-Mssql question Pin
MsmVc21-Dec-09 22:05
MsmVc21-Dec-09 22:05 
GeneralRe: Re-Mssql question Pin
PCuong198321-Dec-09 23:12
professionalPCuong198321-Dec-09 23:12 
GeneralRe: Re-Mssql question Pin
MsmVc21-Dec-09 23:18
MsmVc21-Dec-09 23:18 
GeneralRe: Re-Mssql question Pin
PCuong198322-Dec-09 3:55
professionalPCuong198322-Dec-09 3:55 
Questionneed delete a file in vc++ Pin
kamalilam21-Dec-09 20:04
kamalilam21-Dec-09 20:04 
AnswerRe: need delete a file in vc++ Pin
KingsGambit21-Dec-09 20:11
KingsGambit21-Dec-09 20:11 
AnswerRe: need delete a file in vc++ Pin
Jijo.Raj21-Dec-09 20:49
Jijo.Raj21-Dec-09 20:49 
QuestionPOINT Draw Export/Code Pin
saiyuk6=721-Dec-09 19:25
saiyuk6=721-Dec-09 19:25 
AnswerRe: POINT Draw Export/Code Pin
CPallini21-Dec-09 20:42
mveCPallini21-Dec-09 20:42 
GeneralRe: POINT Draw Export/Code Pin
saiyuk6=724-Dec-09 9:37
saiyuk6=724-Dec-09 9:37 
QuestionDetecting when video is done with media player (in MFC) Pin
Joe Woodbury21-Dec-09 11:57
professionalJoe Woodbury21-Dec-09 11:57 
AnswerRe: Detecting when video is done with media player (in MFC) Pin
Joe Woodbury21-Dec-09 12:42
professionalJoe Woodbury21-Dec-09 12:42 
Questionre: missing mutex events Pin
Alan Kurlansky21-Dec-09 10:59
Alan Kurlansky21-Dec-09 10:59 
AnswerRe: re: missing mutex events Pin
KingsGambit21-Dec-09 19:18
KingsGambit21-Dec-09 19:18 
GeneralRe: re: missing mutex events Pin
Alan Kurlansky22-Dec-09 2:55
Alan Kurlansky22-Dec-09 2:55 
AnswerRe: re: missing mutex events Pin
Rajesh R Subramanian21-Dec-09 20:45
professionalRajesh R Subramanian21-Dec-09 20:45 
GeneralRe: re: missing mutex events Pin
Alan Kurlansky22-Dec-09 2:59
Alan Kurlansky22-Dec-09 2:59 
QuestionDebugging a C++ program in Visual Studio 2005 Pin
loyal ginger21-Dec-09 5:33
loyal ginger21-Dec-09 5:33 
AnswerRe: Debugging a C++ program in Visual Studio 2005 Pin
Abhi Lahare21-Dec-09 5:44
Abhi Lahare21-Dec-09 5:44 
GeneralRe: Debugging a C++ program in Visual Studio 2005 Pin
loyal ginger21-Dec-09 6:03
loyal ginger21-Dec-09 6:03 
GeneralRe: Debugging a C++ program in Visual Studio 2005 Pin
Abhi Lahare21-Dec-09 6:19
Abhi Lahare21-Dec-09 6:19 
GeneralRe: Debugging a C++ program in Visual Studio 2005 Pin
loyal ginger21-Dec-09 6:27
loyal ginger21-Dec-09 6:27 
Questioncan you simplify the function by #define? [modified] Pin
includeh1021-Dec-09 0:16
includeh1021-Dec-09 0:16 
Can you simplify the function by #define or something else?

I want to simplify code bellow, both dll and dynamically reading file are not suitable because of 2 reasons:
1. those files are created by others, if in my way, I only need to re-compile, and do not need to copy the 150 files (will be more soon) into code.
2. there are around 3K of words and sentences in different languages, which can not be used by index. i.e. for string "Apply now", we can not use
CString cs=data[1743]+data[725] - no one can remember which index is which word.
there is a definition class (generated from Data file), looks like:
class Data
{
WORD
*Time,
....,
*Now,
....,
*Apply,
....
};

use is one of #include bellow, then
CString cs=data.Apply+data.Now;
is OK.

void LangData::P_InitLangFull()
{
	char*p0[]=
	{
		#include "Language\english\language_full.h"		
	};	//do some thing

	char*p1[]=
	{
		#include "Language\french\language_full.h"
	};	//do some thing

        //more
	char*p9[]=
	{
		#include "Language\german\language_full.h"
	};	//do some thing
}


Function code above is quite repeat: only language directory name, english, french, ..., german are changed - totally repeated for 10 times.

It is ok if so, but each language directory has 15 file, so I have to "repeat" the function for 15 times, so second to 15th function look like (only file name is different from first function):

every included h file is plain text as:

"good",
"bad",
"next",



void LangData::P_InitWeather()
{
	char*p0[]=
	{
		#include "Language\english\Weather.h"		
	};	//do some thing

	char*p1[]=
	{
		#include "Language\french\Weather.h"
	};	//do some thing

        //more
	char*p9[]=
	{
		#include "Language\german\Weather.h"
	};	//do some thing
}


You can imagine how ugly the file is at last - I haven't completed it.

I think we may simplify code by #define or some idea, but the #include causes trouble to #define.

any ideas or suggestions?

thanks

modified on Monday, December 21, 2009 9:32 AM

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.