Sign in to follow this  

DevC++ and string tables

This topic is 4551 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

You can either download a third party resource editor or write one yourself manually in a created resource file.

Something like the following:

STRINGTABLE
BEGIN
//Attention Strings
ID_STRING_HI "Hello World!"
ID_STRING_BYE "Goodbye World!"
ID_STRING_STUFF "Calculating..."
ID_STRING_FOO "To be truthful, I do not know what foo is"
ID_STRING_ERROR "Something hurts!"
...
END

Share this post


Link to post
Share on other sites
A couple of things to keep in mind: For some bizarre reason, Windows limits you to 16 strings per table. Secondly, you should probably make the string table discardable, which tells Windows that the memory can move around if need be. Finally, in order to do something like what Xiachunyi suggested, you'll need to #define the IDs somewhere.

So, a good string table resource file might look like:

// File resources.rc
#include "resource.h"

STRINGTABLE DISCARDABLE
BEGIN
IDS_STRING1 "String 1"
IDS_STRING2 "String 2"
...
IDS_STRING16 "String 16"
END

STRINGTABLE DISCARDABLE
BEGIN
IDS_STRING17 "String 17"
...
IDS_STRING32 "String 32"
END
...

// File resource.h
#define IDS_STRING1 1001
#define IDS_STRING2 1002
...

Share this post


Link to post
Share on other sites
theres an extention of GNU's GCC where you can make string tables in the code itself:
const char * table[] = {
"string one",
"thing two",
"your mother."
};

Can someone confirm if VC++ can do something similiar?

Share this post


Link to post
Share on other sites
Now if i were to make that string table, and use it for a DLL file full of functions to use in a bunch of different language, I would just need to call the function?

Share this post


Link to post
Share on other sites

This topic is 4551 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this