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 to use the resource file to store all strings?

how to use the resource file to store all strings?

Scheduled Pinned Locked Moved C / C++ / MFC
questiondesigntutoriallearning
4 Posts 4 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.
  • B Offline
    B Offline
    Binayak
    wrote on last edited by
    #1

    Hi, I would like to have all the UI strings in the resource file (including the strings for the messageboxes). How can I put them in the resource file and retrieve them? Thanks,

    J D J 3 Replies Last reply
    0
    • B Binayak

      Hi, I would like to have all the UI strings in the resource file (including the strings for the messageboxes). How can I put them in the resource file and retrieve them? Thanks,

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      You can either add them manually to the .rc file, or do it through the IDE. Just click the ResourceView tab in the Workspace pane. Double-click the String Table resource type, and press the INS key. To retrieve the values, use LoadString().


      A rich person is not the one who has the most, but the one that needs the least.

      1 Reply Last reply
      0
      • B Binayak

        Hi, I would like to have all the UI strings in the resource file (including the strings for the messageboxes). How can I put them in the resource file and retrieve them? Thanks,

        J Offline
        J Offline
        John R Shaw
        wrote on last edited by
        #3

        Go to the resource view in the work space pane and select "String Table", then add your strings. In your code call LoadString(...) (sdk version or CString version). INTP

        1 Reply Last reply
        0
        • B Binayak

          Hi, I would like to have all the UI strings in the resource file (including the strings for the messageboxes). How can I put them in the resource file and retrieve them? Thanks,

          J Offline
          J Offline
          J Eric Vaughan
          wrote on last edited by
          #4

          Go to Project->Add Resource menu item. Select "String Table" and Hit "New". The string editor should come up where you can add strings. To retrieve them: Using MFC: CString strText((LPCTSTR)IDS_MY_TEXT); or CString strText; strText.LoadString( IDS_MY_TEXT ); Non-MFC: TCHAR pszText[MAX_TEXT]; ::LoadString( GetModuleHandle(NULL), IDS_MY_TEXT, pszText, MAX_TEXT ) ____________________________________________ Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. (Rich Cook)

          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