Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How can I get the Resource ID I want?

How can I get the Resource ID I want?

Scheduled Pinned Locked Moved C / C++ / MFC
questiontutoriallearning
10 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    freeman868
    wrote on last edited by
    #1

    Hello,everyone! I want to ask a question about my practice. I created some string entries in the string table such as IDS_STRING1,IDS_STRING2,IDS_STRING3... .Now, I want to load one of them for the CString object by a string I specified. for example, the string I specified was "IDS_STRING1" , how can I convert "IDS_STRING1" to the right Resource ID? Thank u so much!:confused:

    freeman

    T K H M 4 Replies Last reply
    0
    • F freeman868

      Hello,everyone! I want to ask a question about my practice. I created some string entries in the string table such as IDS_STRING1,IDS_STRING2,IDS_STRING3... .Now, I want to load one of them for the CString object by a string I specified. for example, the string I specified was "IDS_STRING1" , how can I convert "IDS_STRING1" to the right Resource ID? Thank u so much!:confused:

      freeman

      T Offline
      T Offline
      toxcct
      wrote on last edited by
      #2

      i'm not sure at all to understand what you want. if i'm right, you want to get the actual string behing the string ID in the resource string table. for this, 2 solutions : CString::LoadString() or CString::Format()


      [VisualCalc][Flags Beginner's Guide] | [Forums Guidelines][My Best Advice]

      F 1 Reply Last reply
      0
      • F freeman868

        Hello,everyone! I want to ask a question about my practice. I created some string entries in the string table such as IDS_STRING1,IDS_STRING2,IDS_STRING3... .Now, I want to load one of them for the CString object by a string I specified. for example, the string I specified was "IDS_STRING1" , how can I convert "IDS_STRING1" to the right Resource ID? Thank u so much!:confused:

        freeman

        K Offline
        K Offline
        kasturi_haribabu
        wrote on last edited by
        #3

        See if this answers your question.... Answer 1: CString Str; Str.Format(IDS_STRING1); Answer 2: CString str; if (! str.LoadString( IDS_STRING1 )) { AfxMessageBox("Error Loading String: IDS_STRING1"); ... }

        F 1 Reply Last reply
        0
        • F freeman868

          Hello,everyone! I want to ask a question about my practice. I created some string entries in the string table such as IDS_STRING1,IDS_STRING2,IDS_STRING3... .Now, I want to load one of them for the CString object by a string I specified. for example, the string I specified was "IDS_STRING1" , how can I convert "IDS_STRING1" to the right Resource ID? Thank u so much!:confused:

          freeman

          H Offline
          H Offline
          Hamid Taebi
          wrote on last edited by
          #4

          In additional with other members after reads Resource with CString::Load on the loop you can read all strings for example IDS_STRING1 has "one,two,three,four," now on a loop set for find , in this string and reads all strings :)


          WhiteSky


          F 1 Reply Last reply
          0
          • F freeman868

            Hello,everyone! I want to ask a question about my practice. I created some string entries in the string table such as IDS_STRING1,IDS_STRING2,IDS_STRING3... .Now, I want to load one of them for the CString object by a string I specified. for example, the string I specified was "IDS_STRING1" , how can I convert "IDS_STRING1" to the right Resource ID? Thank u so much!:confused:

            freeman

            M Offline
            M Offline
            Michael Dunn
            wrote on last edited by
            #5

            There's no automatic way to do that. You'll basically need a lookup table to know that "IDS_STRING1" should be mapped to 101 or whatever the numeric value is.

            --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ Ford, what's this fish doing in my ear?

            F 1 Reply Last reply
            0
            • M Michael Dunn

              There's no automatic way to do that. You'll basically need a lookup table to know that "IDS_STRING1" should be mapped to 101 or whatever the numeric value is.

              --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ Ford, what's this fish doing in my ear?

              F Offline
              F Offline
              freeman868
              wrote on last edited by
              #6

              Thank u, u get my idear!I know how to resolve it now. :)

              freeman

              1 Reply Last reply
              0
              • T toxcct

                i'm not sure at all to understand what you want. if i'm right, you want to get the actual string behing the string ID in the resource string table. for this, 2 solutions : CString::LoadString() or CString::Format()


                [VisualCalc][Flags Beginner's Guide] | [Forums Guidelines][My Best Advice]

                F Offline
                F Offline
                freeman868
                wrote on last edited by
                #7

                Thank u for your reply, I wish u a good day! :)

                freeman

                1 Reply Last reply
                0
                • K kasturi_haribabu

                  See if this answers your question.... Answer 1: CString Str; Str.Format(IDS_STRING1); Answer 2: CString str; if (! str.LoadString( IDS_STRING1 )) { AfxMessageBox("Error Loading String: IDS_STRING1"); ... }

                  F Offline
                  F Offline
                  freeman868
                  wrote on last edited by
                  #8

                  Thank u all the same!:)

                  freeman

                  1 Reply Last reply
                  0
                  • H Hamid Taebi

                    In additional with other members after reads Resource with CString::Load on the loop you can read all strings for example IDS_STRING1 has "one,two,three,four," now on a loop set for find , in this string and reads all strings :)


                    WhiteSky


                    F Offline
                    F Offline
                    freeman868
                    wrote on last edited by
                    #9

                    Thanks! God will bless u. :)

                    freeman

                    H 1 Reply Last reply
                    0
                    • F freeman868

                      Thanks! God will bless u. :)

                      freeman

                      H Offline
                      H Offline
                      Hamid Taebi
                      wrote on last edited by
                      #10

                      You're welcome :)


                      WhiteSky


                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups