#define value for string table addition

Ah hello.

Regarding the string table editor in VS.NET 2003, how can I determine which is the next value that will be used for a new string ?  (i.e. every new string added gets a #define value for it).  I thought the key was the following section of resource.h:

#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE        130
#define _APS_NEXT_COMMAND_VALUE         32771
#define _APS_NEXT_CONTROL_VALUE         1006
#define _APS_NEXT_SYMED_VALUE           101
#endif
#endif

however,

_APS_NEXT_RESOURCE_VALUE only increments when I add a new resource (like dialog or menu)
_APS_NEXT_CONTROL_VALUE only increments when I add a new control, like a button
_APS_NEXT_COMMAND_VALUE only increments when I add a new command, like a menu option handler
_APS_NEXT_SYMED_VALUE is apparently to do with adding new symbols.  

I have read the suggested links (mainly http://msdn2.microsoft.com/en-us/library/6t3612sk(VS.80).aspx) but still don't know how the ID for a new string is defined.

Does anyone here ?

TIA
LVL 19
mrwad99Asked:
Who is Participating?
 
mahesh1402Connect With a Mentor Commented:
If you have multiple resource files in a projects it allows you to give the same for different resources and also generates the same id for different resources.

This tech note might be also useful if you have multiple resource / header files :

TN035: Using Multiple Resource Files and Header Files with Visual C++
http://msdn2.microsoft.com/en-us/library/6t3612sk.aspx

AFAIK there is nothing 'inbuilt' to fix already duplicated ID's other than manually editing the resource files or any third party plugin. Having chosen a unique set of ranges for each file simply renumber the existing stuff from the top down. There is no real significance in the numbers, except the command IDs should be above 32K. You could even construct a small program to do this for you.

-MAHESH

0
 
AndyAinscowConnect With a Mentor Freelance programmer / ConsultantCommented:
I think the whole matter is complicated by the fact that some resources (eg. toolbar buttons, menu items) can have a string associated with them.

Exactly how the resource editor works to get the next ID to use for a string I honestly do not know.

Is this just a general question for your own edification or do you have a specific requirement?
0
 
mrwad99Author Commented:
Thanks Andy

>> Is this just a general question for your own edification or do you have a specific requirement?

I really need to know.  The thing is, I have a big project with loads and loads of strings in it, and I am now adding new ones, but found that when I run the program, some parts of the UI have the incorrect strings due to the new string IDs clashing with ones already existing.

This led me to realise that if I do not figure out how to solve this, it could get to the point where I have far too many strings to sort the problem.
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
AndyAinscowFreelance programmer / ConsultantCommented:
:-(
0
 
AndyAinscowFreelance programmer / ConsultantCommented:
Do you have just one .rc file and one resource.h file ?
0
 
mahesh1402Commented:
>>I have a big project with loads and loads of strings in it, and I am now adding new ones,

this problem is occuring due to duplicating resource by copy paste and renaming resource names ?

btw if you refer following tech note general strings having valid range of  1 -> 0x7FFF
 
'TN020: ID Naming and Numbering Conventions'
http://msdn2.microsoft.com/en-US/library/t2zechd4.aspx

you may also refer this possible cause of resource id clash by copy/paste and rename
http://www.kbalertz.com/141345/Duplicating.Resource.Causes.Resource.Collision.aspx

-MAHESH
0
 
AndyAinscowFreelance programmer / ConsultantCommented:
A further question for you - is it mixing strings in dll's and exe's ?
0
 
mrwad99Author Commented:
Andy: no, these strings are just in the program EXE itself.  It would not be a problem if duplicate string IDs exist in the exe and in separate DLLs anyway, as long as I set the resource handle to be appropriate.

I will close this soon if nothing else happens here.
0
 
AndyAinscowFreelance programmer / ConsultantCommented:
exe's and dll's - that is the answer I expected BUT it was better to confirm it.
0
 
AndyAinscowFreelance programmer / ConsultantCommented:
This might be of use to you
http://www.codeproject.com/macro/resorg.asp
0
 
mrwad99Author Commented:
Thanks both.  Since the answer was not found, I will still give the points for effort.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.