-
January 6th, 2011, 05:55 AM
#16
Re: Resources ID based on other resources ID
Originally Posted by pascal_33
it was only an example for the problem explanation
Originally Posted by pascal_33
Please post a minimal but complete example. There's no point in us guessing what code or project settings you have.
Cheers, D Drmmr
Please put [code][/code] tags around your code to preserve indentation and make it more readable.
As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky
-
January 6th, 2011, 07:14 AM
#17
Re: Resources ID based on other resources ID
Originally Posted by pascal_33
One more thing.... that link is specific to Visual Studio 2010. Is that the compiler version you're using?
"A problem well stated is a problem half solved.” - Charles F. Kettering
-
January 6th, 2011, 08:17 AM
#18
Re: Resources ID based on other resources ID
Originally Posted by John E
One more thing.... that link is specific to Visual Studio 2010. Is that the compiler version you're using?
yes
but the same resource apply for all versions beginning from VS 2003 .net (there is other versions links in the page)
-
January 6th, 2011, 08:25 AM
#19
Re: Resources ID based on other resources ID
Dear pascal_33!
Is the 2.5 hours not enough to create what D_Drmmr has asked?
Originally Posted by D_Drmmr
Please post a minimal but complete example. There's no point in us guessing what code or project settings you have.
Victor Nijegorodov
-
January 6th, 2011, 08:27 AM
#20
Re: Resources ID based on other resources ID
Hi,
Just checked this out myself, I see the same as you, i.e. expressions are not evaluated, so I looked at this note on the MSDN page you linked:
If a string or a numeric expression is expected, then the expression is not evaluated.
Since a resource ID can be either a string or a numeric expression, looks like that covers it.
-
January 6th, 2011, 09:09 AM
#21
Re: Resources ID based on other resources ID
Below is the rc file :
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "dialogh2.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Français (France) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)
#pragma code_page(1252)
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_CANCEL ICON "dialogh_bmp/cancel2.ico"
1 ICON "dialogh_bmp/AppIcon.ico"
resource.h :
#define IDC_OK 1
dialogh2.h
#define IDI_CANCEL (IDC_OK+20000)
Creating the file "dialog2.h" is needed (following MSDN method) as read-only file (rc editor will not modify it in any way).
result : IDI_CANCEL should be calculated and get 20001 value. But no, it is not calculated and get a 0 value (cancel2.ico became the application icon)
-
January 6th, 2011, 09:13 AM
#22
Re: Resources ID based on other resources ID
Originally Posted by alanjhd08
Hi,
Just checked this out myself, I see the same as you, i.e. expressions are not evaluated, so I looked at this note on the MSDN page you linked:
If a string or a numeric expression is expected, then the expression is not evaluated.
Since a resource ID can be either a string or a numeric expression, looks like that covers it.
yes, but there is also
The environment will correctly interpret these calculated symbols as long as:
* The calculated symbols are placed in a read-only symbols file.
* Your resource file contains resources to which these calculated symbols are already assigned.
* A numeric expression is expected.
All this does not appear very clear ....
-
January 6th, 2011, 09:39 AM
#23
Re: Resources ID based on other resources ID
pascal_33 - I don't wish to seem disrespectful but week after week on this site we find ourselves strugglling to solve problems for newbies who are only willing to release small snippets of code that only tell part of the story. As has been pointed out earlier though, resource IDs can either be numbers or strings. In your case it looks as if an expression like (IDC_OK+20000) will get interpreted as a string, rather than a number which is what you were hoping for. If that doesn't seem to explain your problem, the only other way to solve it would be for you to upload a small (but buildable) example program. Only then will anyone be able to figure out if you've done something wrong.
"A problem well stated is a problem half solved.” - Charles F. Kettering
-
January 6th, 2011, 09:52 AM
#24
Re: Resources ID based on other resources ID
Originally Posted by pascal_33
#include "dialogh2.h"
Originally Posted by pascal_33
dialogh2.h
Originally Posted by pascal_33
Creating the file "dialog2.h" is needed (following MSDN method) as read-only file (rc editor will not modify it in any way).
The last reference uses a different name. Probably a typo in this here post, but just pointing out.
Originally Posted by pascal_33
Creating the file "dialog2.h" is needed (following MSDN method) as read-only file (rc editor will not modify it in any way).
Just want to point out that the "read-only" ONLY refers to the fact that neither VC nor the resource compiler will modify the .h files listed here. They are "readonly" in use.
This does NOT mean that the file in question needs to have the read-only file attribute set or requires some other special rights to actually make it unwritable.
-
January 6th, 2011, 09:57 AM
#25
Re: Resources ID based on other resources ID
As already said multiple times, please post a sample project.
It could have several reasons. For example, we don't know how you are using those resource IDs in your code.
-
January 6th, 2011, 10:08 AM
#26
Re: Resources ID based on other resources ID
@ John E and Marc G
I fully understand that you request a full project. But it is very complicated because my app rely on OWLNET libraries (https://sourceforge.net/apps/mediawi...itle=Main_Page)
Nobody want to take hours to install and compile these libraries.
alanjhd08 did a test, and he got same results as me.
My main question is how do you understand this MSDN page ?
http://msdn.microsoft.com/en-us/library/zakskay9.aspx
-
January 6th, 2011, 10:13 AM
#27
Re: Resources ID based on other resources ID
Originally Posted by OReubens
The last reference uses a different name. Probably a typo in this here post, but just pointing out.
Just want to point out that the "read-only" ONLY refers to the fact that neither VC nor the resource compiler will modify the .h files listed here. They are "readonly" in use.
This does NOT mean that the file in question needs to have the read-only file attribute set or requires some other special rights to actually make it unwritable.
yes, typo error, sorry.
About read-only , of course it is not related to the file attributes but to the method used to add it from the "resource include" dialog : "Read-only symbol directives" input
-
January 6th, 2011, 10:15 AM
#28
-
January 6th, 2011, 10:19 AM
#29
Re: Resources ID based on other resources ID
Originally Posted by pascal_33
yes, typo error, sorry.
And where was this "typo": in the source code or in you posts? If the latter - then it one more reason to post a real working project instead of buggy "snippets" with a lot of "typos"
Victor Nijegorodov
-
January 6th, 2011, 10:25 AM
#30
Re: Resources ID based on other resources ID
pascal_33 - we all understand how frustrating it is to be constantly asked for a small sample project when you think you've already given us all the relevant information but the simple truth is that we've all been down this road, many times before.
Just last week I spent over two days trying to solve a newbie's question - only for him to admit that he'd found the problem in a completely different part of the code that he hadn't told anyone about!
"A problem well stated is a problem half solved.” - Charles F. Kettering
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|