Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ MFC Toolbar Bitmap
CMDIFrameWnd* pFrame = new CMainFrame;
if (!pFrame)
    return FALSE;
m_pMainWnd = pFrame;
// create main MDI frame window
if (!pFrame->LoadFrame(IDR_MAINFRAME))
    return FALSE;
 
I have created MDI application which has one toolbar (With 5 buttons, coming through a Toolbar.bmp image)
 
Now, instead of showing the default images, I want to show my custom ones and replaced the used toolbar bitmap with my new; But surprisingly it is crashing in pImage->LoadFrame(..);
 
Any Idea why it is crashing? I just replaced the BMP image with same number of buttons!! (Custom Toolbar.bmp)
 
Thanks
 
enhzflep: Altered tags. Removed MDI, added MFC, Toolbar
Posted 12-May-13 7:26am
iDebD842
Edited 12-May-13 17:53pm
(no name)38.2K
v4
Comments
enhzflep at 12-May-13 12:44pm
   
Quite possibly (probably?) an issue with image encoding. I'd check the following:
1) Dimensions
2) Bit depth
3) Byte ordering - rgb or bgr
iDebD at 12-May-13 13:04pm
   
1) Dimensions are different: Previously 80x15, now 160 x 32
2) Bit Depth: Previously 4, now 24
3) Both RGB
 
I have to use this BMP, no clue how to fit this current projet? Dimensions are not problem as this can be modified;
enhzflep at 12-May-13 22:48pm
   
I'll assume this was intended for me (as is the only sane thing to do) - You should hit the ( "<- Reply" button to the right of a person's comment to respond to them. The "Have a Question or Comment" button is for responding to the original question, or a solution. Whichever the button follows.
 
Anyhow, the problem is the bit-depth. MFC organizes an internal image-list to hold the bitmaps. It's a 4 bit image list...
 
Here's a solution at stackoverflow: Higher bit-depth for MFC toolbar icons

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 381
1 Praneet Nadkar 237
2 Marcin Kozub 225
3 Sergey Alexandrovich Kryukov 200
4 Shweta N Mishra 161
0 OriginalGriff 8,284
1 Sergey Alexandrovich Kryukov 7,327
2 DamithSL 5,614
3 Manas Bhardwaj 4,986
4 Maciej Los 4,920


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 12 May 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100