Click here to Skip to main content
15,890,336 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello i am wondering would it be a good idea to load multiple strings from a resource at once. I was thinking of using STL std::map<int,std::string> to hold all the multiple strings and use a macro to find the string on the fly so it doesn't have to always call LoadString.

The Initializing function would be called on start-up to process all the strings
Posted
Updated 12-Jan-10 8:02am
v3

You *could* create a dictionary collection of strings, and as you load them, put the resource ID and the string into this dictionary as you load them, and then write a method that would first check the dictionary (by key aka the resource ID, or by string) to see if the string is already retrieved, and if not, get it from the resource file and store it in the dictionary for the next time.
 
Share this answer
 
v2
I suppose there is no performance penalty in calling LoadString multiple times (if is performance that concerns you).
:)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900