DevC++ and string tables

Started by
4 comments, last by Fixxer 18 years, 9 months ago
Since DevC++ doesnt have a resource editor like VC++ 6.0, how can I make string tables in DevC++?
Advertisement
You can either download a third party resource editor or write one yourself manually in a created resource file.

Something like the following:
STRINGTABLEBEGIN//Attention StringsID_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
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 DISCARDABLEBEGIN    IDS_STRING1    "String 1"    IDS_STRING2    "String 2"    ...    IDS_STRING16   "String 16"ENDSTRINGTABLE DISCARDABLEBEGIN    IDS_STRING17   "String 17"    ...    IDS_STRING32   "String 32"END...// File resource.h#define IDS_STRING1  1001#define IDS_STRING2  1002...
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?
william bubel
That's not an 'extension', that's perfectly legal C++ syntax. It's C, even.
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?

This topic is closed to new replies.

Advertisement