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. Problem with loading resources at runtime

Problem with loading resources at runtime

Scheduled Pinned Locked Moved C / C++ / MFC
helpcsharpvisual-studiodebuggingquestion
5 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.
  • D Offline
    D Offline
    Dean Goodman
    wrote on last edited by
    #1

    I always seem to have the strangest problems with visual studio... :)

    I have been working on a project that up until yesterday compiled and ran fine. Now, the debug version asserts on calls that load a resource, such as a menu or child dialog. In fact the program asserts when just trying to get the handle for the system icon of the main dialog box!

    m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); //assertion

    The assertion is always in AfxGetResourceHandle() which makes me believe that somehow Visual Studio has lost the "connection" between my user created dialogs, menus, etc. and the code that eventually loads them.

    As I said before, nothing has changed in my project except that I have added a couple of new dialogs. I actually had this problem with one of the new dialogs yesterday too, but I was able to remove it from the project and put it back in and it worked fine -- it wasn't too much work since I had just added it. Obviously that isn't an option for the main dialog of my project...

    Has anyone had a similar problem, and if so, how did you fix it?

    TIA,
    --Dean

    N A 2 Replies Last reply
    0
    • D Dean Goodman

      I always seem to have the strangest problems with visual studio... :)

      I have been working on a project that up until yesterday compiled and ran fine. Now, the debug version asserts on calls that load a resource, such as a menu or child dialog. In fact the program asserts when just trying to get the handle for the system icon of the main dialog box!

      m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); //assertion

      The assertion is always in AfxGetResourceHandle() which makes me believe that somehow Visual Studio has lost the "connection" between my user created dialogs, menus, etc. and the code that eventually loads them.

      As I said before, nothing has changed in my project except that I have added a couple of new dialogs. I actually had this problem with one of the new dialogs yesterday too, but I was able to remove it from the project and put it back in and it worked fine -- it wasn't too much work since I had just added it. Obviously that isn't an option for the main dialog of my project...

      Has anyone had a similar problem, and if so, how did you fix it?

      TIA,
      --Dean

      N Offline
      N Offline
      Navin
      wrote on last edited by
      #2

      Stock Visual response: have you tried doing a clean, full rebuild of everything? Even if you win the rat race, you're still a rat.

      D 1 Reply Last reply
      0
      • N Navin

        Stock Visual response: have you tried doing a clean, full rebuild of everything? Even if you win the rat race, you're still a rat.

        D Offline
        D Offline
        Dean Goodman
        wrote on last edited by
        #3

        I tried that but it didn't work. I went so far as to start comparing files such as .rc, .clw, and resource.[fd|h] with backup copies I made a while ago, and I couldn't see any difference other than due to the new resources I have added.
        --Dean

        D 1 Reply Last reply
        0
        • D Dean Goodman

          I tried that but it didn't work. I went so far as to start comparing files such as .rc, .clw, and resource.[fd|h] with backup copies I made a while ago, and I couldn't see any difference other than due to the new resources I have added.
          --Dean

          D Offline
          D Offline
          Dy
          wrote on last edited by
          #4

          This sounds very similar to a problem I had here when ever I added new resources, in the end I went through the app removing any unused resources that they may have been (you can end up with a few when development spans years / multiple developers... sigh) I don't know what the details of the problem were, but it probably had something to do with running out of resource space :~


          Dylan Kenneally London, UK

          1 Reply Last reply
          0
          • D Dean Goodman

            I always seem to have the strangest problems with visual studio... :)

            I have been working on a project that up until yesterday compiled and ran fine. Now, the debug version asserts on calls that load a resource, such as a menu or child dialog. In fact the program asserts when just trying to get the handle for the system icon of the main dialog box!

            m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); //assertion

            The assertion is always in AfxGetResourceHandle() which makes me believe that somehow Visual Studio has lost the "connection" between my user created dialogs, menus, etc. and the code that eventually loads them.

            As I said before, nothing has changed in my project except that I have added a couple of new dialogs. I actually had this problem with one of the new dialogs yesterday too, but I was able to remove it from the project and put it back in and it worked fine -- it wasn't too much work since I had just added it. Obviously that isn't an option for the main dialog of my project...

            Has anyone had a similar problem, and if so, how did you fix it?

            TIA,
            --Dean

            A Offline
            A Offline
            Atlantys
            wrote on last edited by
            #5

            I've had issues like that when i went through and manually edited the resource.h file.... to fix it, i just cleaned the project and did a rebuild all. i think devstudio just needs a kick to make it use the new constants. hopefully this fix'll work for you!:-D

            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