LoadBitmap results in Assertion at AfxMakeResourceHandle
-
Greetings, Frustrations from yesterday.I am trying to load a bitmap into a CBitmap object. I have succesfully done this 100 times before but this time I get an assertion error caused at AfxMakeResourceHandle(). I am calling the LoadBitmap() function at the constructor so it only takes place ones, so its not a problem of loading a bitmap over an existing one. The image exists and the path is correct and the function is as follows: [code] m_bmKnob.LoadBitmap(IDB_51MAX); [/code] I have already made sure that there is no duplicate IDB number. Cannot find any informationm about this elsewhere. Something tells me its something very small and silly that I am missing but I have been going over and over it with no luck... :^) Thanks!
-
Greetings, Frustrations from yesterday.I am trying to load a bitmap into a CBitmap object. I have succesfully done this 100 times before but this time I get an assertion error caused at AfxMakeResourceHandle(). I am calling the LoadBitmap() function at the constructor so it only takes place ones, so its not a problem of loading a bitmap over an existing one. The image exists and the path is correct and the function is as follows: [code] m_bmKnob.LoadBitmap(IDB_51MAX); [/code] I have already made sure that there is no duplicate IDB number. Cannot find any informationm about this elsewhere. Something tells me its something very small and silly that I am missing but I have been going over and over it with no luck... :^) Thanks!
Some more details... According to MSDN AfxGetResourceHandle is: Use the HINSTANCE handle returned by this function to access the application's resources directly, for example, in calls to the Windows function FindResource. Example //Load the menu specifying the module handle where resource is to be //found & resource ID HMENU hMenu = ::LoadMenu(AfxGetResourceHandle(), MAKEINTRESOURCE(IDR_PANEL)); I have also tried: m_bmKnob.FromHandle(LoadBitmap(_AtlBaseModule.GetModuleInstance(), MAKEINTRESOURCE(IDB_51MAX))); That compiles and doesn't give an assertion, however later when the bitmap needs to be used it crashes as actually nothing was ever "sucessfully" loaded into theCBitmap file. Does this shed any light into possibilities? I willl post any progress as soon as there is some...have a nice weekend!
-
Some more details... According to MSDN AfxGetResourceHandle is: Use the HINSTANCE handle returned by this function to access the application's resources directly, for example, in calls to the Windows function FindResource. Example //Load the menu specifying the module handle where resource is to be //found & resource ID HMENU hMenu = ::LoadMenu(AfxGetResourceHandle(), MAKEINTRESOURCE(IDR_PANEL)); I have also tried: m_bmKnob.FromHandle(LoadBitmap(_AtlBaseModule.GetModuleInstance(), MAKEINTRESOURCE(IDB_51MAX))); That compiles and doesn't give an assertion, however later when the bitmap needs to be used it crashes as actually nothing was ever "sucessfully" loaded into theCBitmap file. Does this shed any light into possibilities? I willl post any progress as soon as there is some...have a nice weekend!
are these resources in your EXE, or do they live in some external DLL ? Image Toolkits | Image Processing | Cleek
-
are these resources in your EXE, or do they live in some external DLL ? Image Toolkits | Image Processing | Cleek
Hello, The project contains several ATL based ActiveX controls with MFC support, the resources are added to the project.
-
Hello, The project contains several ATL based ActiveX controls with MFC support, the resources are added to the project.
Well... it seems the answer is the following: [code] CBitmap myBitmap; AFX_MANAGE_STATE(AfxGetStaticModuleState()); myBitmap.LoadBitmap(IDB_SOMEBITMAP); [/code] Now I need to figure out what that all means! Ciao