CBitmap::LoadBitmap help
-
ForNow wrote:
would you know the correct entry
According your OP it should be:
ForNow wrote:
Here is My rc statement
IDB_BITMAP1 BITMAP "res\\bitmap1.bmp"
-
I re-checked the doc and it say I can put in the full path name of the bitmap going to do that I’ll also do a getlasterror if RC _!= 0 Thanks
You should not need to as the location is only required by the compiler when it builds the executable. Part of the build process is to embed all resources into the final executable. You can check it by getting hold of one of the many free resource editors available online.
-
You should not need to as the location is only required by the compiler when it builds the executable. Part of the build process is to embed all resources into the final executable. You can check it by getting hold of one of the many free resource editors available online.
-
so the bitmap is in the exe I google and see a product Resource tuner maybe i should try it see if it finds the bitap and maybe the problem is I didn't link it in right with the res file thanks
-
I am trying to load a bit map its in my res folder in fact I have also copied it folder where my .exe is it fail to load Here is My rc statement
IDB_BITMAP1 BITMAP "res\\bitmap1.bmp"
and I do a CBitmap.LoadBitmap(IDB_BITMAP1); The return code is 0 The Documentations says
Quote:
by the ID number in nIDResource from the application's executable file.
does that mean I have to link the application a certain way thanks
Did a Cimage load the HRESULT was 0 did CBitmap::Attach (there is not documentation on this) but return code was 1 when I looked at the n_hObject in VS debugger it had high order X'FF' the handle was FFFFFFFF88052070 never saw a resource handle with high order X'FF' ITS usually zeros
-
Did a Cimage load the HRESULT was 0 did CBitmap::Attach (there is not documentation on this) but return code was 1 when I looked at the n_hObject in VS debugger it had high order X'FF' the handle was FFFFFFFF88052070 never saw a resource handle with high order X'FF' ITS usually zeros
1. "the HRESULT was 0" (S_OK) means the function completed successfully. 2. "(there is not documentation on CBitmap::Attach)". However, there is a documentation on its base class method: [CGdiObject Class | Microsoft Docs](https://docs.microsoft.com/en-us/cpp/mfc/reference/cgdiobject-class?view=msvc-160#attach)
-
Did a Cimage load the HRESULT was 0 did CBitmap::Attach (there is not documentation on this) but return code was 1 when I looked at the n_hObject in VS debugger it had high order X'FF' the handle was FFFFFFFF88052070 never saw a resource handle with high order X'FF' ITS usually zeros
I suspect that whatever results you got are not valid, since you need to pass a GDI object to the Attach call in the first place. So what were you trying to attach? As I suggested earlier you definitely need to find out whether this image actually exists in your executable's resources, and if not, why not?
-
Did a Cimage load the HRESULT was 0 did CBitmap::Attach (there is not documentation on this) but return code was 1 when I looked at the n_hObject in VS debugger it had high order X'FF' the handle was FFFFFFFF88052070 never saw a resource handle with high order X'FF' ITS usually zeros
-
As I have mentioned previously I do not have MFC. But recreating what you are trying to do in pure Win32 (which is what MFC does under the covers) I have successfully loaded and displayed a bitmap resource.
thanks for your help I re-linked my app and after I did the attach the HANDLE had leading zeros and displayed I played around with BitBlt and StreachBlt One problem the RED bullet is placed in the middle of a rectangle the color of the rectangle is black. So my static control is gray. and there is a black squared with a red bullet. Is there anyway to have the black "background color of the bitmap rectangle" be the the same as the background of the destination control I have tried creating a brush with that control color selecting/selectobjct and CDC::Fillrect and FillSolidRect Doesn't seem to have any effect Thanks
-
thanks for your help I re-linked my app and after I did the attach the HANDLE had leading zeros and displayed I played around with BitBlt and StreachBlt One problem the RED bullet is placed in the middle of a rectangle the color of the rectangle is black. So my static control is gray. and there is a black squared with a red bullet. Is there anyway to have the black "background color of the bitmap rectangle" be the the same as the background of the destination control I have tried creating a brush with that control color selecting/selectobjct and CDC::Fillrect and FillSolidRect Doesn't seem to have any effect Thanks
Try to use icon (with transparent background) instead.
-
Try to use icon (with transparent background) instead.