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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CMAP vs String table resource

CMAP vs String table resource

Scheduled Pinned Locked Moved C / C++ / MFC
databasevisual-studiolearningworkspace
8 Posts 3 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.
  • E Offline
    E Offline
    econy
    wrote on last edited by
    #1

    Hi, now I need to create a dictionary in an application. The dictionary likes a text file,contains about 800 items, what I mean it likes a text file is that it don't need to change, once it be created, just like a configuration file. Program need to read it, index one item and show a string linked to the item. So I figure it be better to use a string table resource. but unfortunately, the index ID is beyond 65535. (given by others, and it is a standard) . I know I can decode the index ID to 0-800 range. So I think maybe I can use a CMAP, but I wonder if CMAP is suitable, since CMAP every time program start, I need to create an object. Appreciate any advices.

    L CPalliniC 2 Replies Last reply
    0
    • E econy

      Hi, now I need to create a dictionary in an application. The dictionary likes a text file,contains about 800 items, what I mean it likes a text file is that it don't need to change, once it be created, just like a configuration file. Program need to read it, index one item and show a string linked to the item. So I figure it be better to use a string table resource. but unfortunately, the index ID is beyond 65535. (given by others, and it is a standard) . I know I can decode the index ID to 0-800 range. So I think maybe I can use a CMAP, but I wonder if CMAP is suitable, since CMAP every time program start, I need to create an object. Appreciate any advices.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      How do you get to an index of 65535+ with only 800 items? You could use something like a message resource (see http://msdn.microsoft.com/en-us/library/aa385633.aspx[^]), or a user defined resource (see http://msdn.microsoft.com/en-us/library/aa381054.aspx[^]).

      E 1 Reply Last reply
      0
      • E econy

        Hi, now I need to create a dictionary in an application. The dictionary likes a text file,contains about 800 items, what I mean it likes a text file is that it don't need to change, once it be created, just like a configuration file. Program need to read it, index one item and show a string linked to the item. So I figure it be better to use a string table resource. but unfortunately, the index ID is beyond 65535. (given by others, and it is a standard) . I know I can decode the index ID to 0-800 range. So I think maybe I can use a CMAP, but I wonder if CMAP is suitable, since CMAP every time program start, I need to create an object. Appreciate any advices.

        CPalliniC Offline
        CPalliniC Offline
        CPallini
        wrote on last edited by
        #3

        You might

        • Serialize the CMap.

        or

        • Prefix each string in the string table with the hexadecimal representation of its index.

        Don't know which one is the ugliest... :-)

        Veni, vidi, vici.

        In testa che avete, signor di Ceprano?

        E 1 Reply Last reply
        0
        • L Lost User

          How do you get to an index of 65535+ with only 800 items? You could use something like a message resource (see http://msdn.microsoft.com/en-us/library/aa385633.aspx[^]), or a user defined resource (see http://msdn.microsoft.com/en-us/library/aa381054.aspx[^]).

          E Offline
          E Offline
          econy
          wrote on last edited by
          #4

          Thanks

          1 Reply Last reply
          0
          • CPalliniC CPallini

            You might

            • Serialize the CMap.

            or

            • Prefix each string in the string table with the hexadecimal representation of its index.

            Don't know which one is the ugliest... :-)

            Veni, vidi, vici.

            E Offline
            E Offline
            econy
            wrote on last edited by
            #5

            Thanks,HEX is a good idea; and could you explain the reason to Serialize it ?

            CPalliniC 1 Reply Last reply
            0
            • E econy

              Thanks,HEX is a good idea; and could you explain the reason to Serialize it ?

              CPalliniC Offline
              CPalliniC Offline
              CPallini
              wrote on last edited by
              #6

              Because you need to persist it. Unless you want to read the original text file all the times.

              Veni, vidi, vici.

              In testa che avete, signor di Ceprano?

              E 1 Reply Last reply
              0
              • CPalliniC CPallini

                Because you need to persist it. Unless you want to read the original text file all the times.

                Veni, vidi, vici.

                E Offline
                E Offline
                econy
                wrote on last edited by
                #7

                Thanks

                CPalliniC 1 Reply Last reply
                0
                • E econy

                  Thanks

                  CPalliniC Offline
                  CPalliniC Offline
                  CPallini
                  wrote on last edited by
                  #8

                  You are welcome.

                  Veni, vidi, vici.

                  In testa che avete, signor di Ceprano?

                  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