Problem with loading resources at runtime
-
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 -
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 -
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.
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 -
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.
--DeanThis 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
-
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,
--DeanI'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