Alright so I have recently made the decision to put every string in my application into a STRINGTABLE, so I can easily translate to different languages. I know how to use the LoadString() api, but this involves me having a different variable for every string I want to load, and if my application has 100 strings, thats alot of variables. Is this the best way to do this? Or should i create a global variable thats used as a buffer to load the strings as needed? Also since there's no way of knowing how big my string is should I just create a big enough buffer to hold any string i could possible have, or is there a better method of doing this?
Also is loading the strings as needed bad for performance? Is there any way i can preload them?
RE: Okay i've tried creating a buffer 256 bytes in size and loading the strings into that as needed, though i ran into a little problem...
Here's my code thats displaying an error message, the error is "Error allocating memory!"
LoadString(g_hInst, IDS_ERROR_MEMORY, szBuffer, sizeof(szBuffer)/sizeof(TCHAR)); MessageBox(NULL, szBuffer, TEXT("Error"), MB_OK | MB_ICONERROR); ExitProcess(1);
And I have my buffer as a global variable: TCHAR szBuffer[256];
This works but, id like to also store the "Error" text into the string table and load that when I want to display the error, problem is that would require me to have 2 global variables to load the strings, and there are some places where i need to load even more then that at a time.
Is there a better solution then having multiple global variables?