Resources ID based on other resources ID - Page 2
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 41

Thread: Resources ID based on other resources ID

  1. #16
    Join Date
    Jul 2005
    Location
    Netherlands
    Posts
    2,012

    Re: Resources ID based on other resources ID

    Quote Originally Posted by pascal_33 View Post
    it was only an example for the problem explanation
    Quote Originally Posted by pascal_33 View Post
    Yes, but following microsoft
    http://msdn.microsoft.com/en-us/library/zakskay9.aspx
    it should work !
    but it does not
    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

  2. #17
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,235

    Re: Resources ID based on other resources ID

    Quote Originally Posted by pascal_33 View Post
    Yes, but following microsoft
    http://msdn.microsoft.com/en-us/library/zakskay9.aspx
    it should work !
    but it does not
    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

  3. #18
    Join Date
    Jan 2011
    Posts
    19

    Re: Resources ID based on other resources ID

    Quote Originally Posted by John E View Post
    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)

  4. #19
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,288

    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?
    Quote Originally Posted by D_Drmmr View Post
    Please post a minimal but complete example. There's no point in us guessing what code or project settings you have.
    Victor Nijegorodov

  5. #20
    Join Date
    Aug 2008
    Location
    Scotland
    Posts
    379

    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.

  6. #21
    Join Date
    Jan 2011
    Posts
    19

    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)

  7. #22
    Join Date
    Jan 2011
    Posts
    19

    Re: Resources ID based on other resources ID

    Quote Originally Posted by alanjhd08 View Post
    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 ....

  8. #23
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,235

    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

  9. #24
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    3,765

    Re: Resources ID based on other resources ID

    Quote Originally Posted by pascal_33 View Post
    #include "dialogh2.h"
    Quote Originally Posted by pascal_33 View Post
    dialogh2.h
    Quote Originally Posted by pascal_33 View Post
    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.



    Quote Originally Posted by pascal_33 View Post
    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.

  10. #25
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,062

    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.

  11. #26
    Join Date
    Jan 2011
    Posts
    19

    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

  12. #27
    Join Date
    Jan 2011
    Posts
    19

    Re: Resources ID based on other resources ID

    Quote Originally Posted by OReubens View Post
    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

  13. #28
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,288

    Re: Resources ID based on other resources ID

    Quote Originally Posted by pascal_33 View Post
    @ John E and Marc G
    I fully understand that you request a full project.
    No, you didn't understand!
    No one here needs your "full project"!
    We need a very small project that reproduces the same problem you do have now! A very very small! (Or you mean that without linking to "OWLNET libraries" you could not reproduce your problem?
    Victor Nijegorodov

  14. #29
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,288

    Re: Resources ID based on other resources ID

    Quote Originally Posted by pascal_33 View Post
    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

  15. #30
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,235

    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

Page 2 of 3 FirstFirst 123 LastLast

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
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center