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. Help - CString::LoadString(nID) is using the wrong resource handle!

Help - CString::LoadString(nID) is using the wrong resource handle!

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestionalgorithmslearning
3 Posts 2 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.
  • J Offline
    J Offline
    James Millson
    wrote on last edited by
    #1

    I am building a library that will be linked to dynamically by other applications. In the library I load strings from the resource string table for the DLL using CString::LoadString(nID). The problem is that once the DLL is loaded, CString::LoadString(nID) tries to load the string resource from the applications resource table, rather than the DLLs. I have tried setting the resource handle (using AfxSetResourceHandle(…)) both sides of the call, but it still looks for the string in the applications resource. How can I get it so an calls in the DLL’s code to CString::LoadString(nID) load the string from the DLL’s resource table, and any calls in the application’s code load the string from the app’s resource table. Get it? Any help would be appreciated. I have tried searching my installed MSDN, but nothing came up that I could see to be useful. Cheers, James Millson

    C 1 Reply Last reply
    0
    • J James Millson

      I am building a library that will be linked to dynamically by other applications. In the library I load strings from the resource string table for the DLL using CString::LoadString(nID). The problem is that once the DLL is loaded, CString::LoadString(nID) tries to load the string resource from the applications resource table, rather than the DLLs. I have tried setting the resource handle (using AfxSetResourceHandle(…)) both sides of the call, but it still looks for the string in the applications resource. How can I get it so an calls in the DLL’s code to CString::LoadString(nID) load the string from the DLL’s resource table, and any calls in the application’s code load the string from the app’s resource table. Get it? Any help would be appreciated. I have tried searching my installed MSDN, but nothing came up that I could see to be useful. Cheers, James Millson

      C Offline
      C Offline
      Chris Losinger
      wrote on last edited by
      #2

      try the ::LoadString API function (instead of CString::LoadString). -c ------------------------------ Smaller Animals Software, Inc. http://www.smalleranimals.com

      J 1 Reply Last reply
      0
      • C Chris Losinger

        try the ::LoadString API function (instead of CString::LoadString). -c ------------------------------ Smaller Animals Software, Inc. http://www.smalleranimals.com

        J Offline
        J Offline
        James Millson
        wrote on last edited by
        #3

        Thanks, that worked perfectly.

        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