this is my first question on stackoverflow and i hope i do everything right:S
As described in my titel i am working on a visual studio(2012) project with mfc. I try to add a bitmap to my cbutton, which was inserted in the design view to my dialog.
All post i've read about this, describe to use setBitmap or sendMessage to do so. I always try to do this in the onInit()-function of my dialog. When i (try to) use setBitmap() like this:
m_backButton.Attach (LoadBitmap (AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_BACK_BUTTON))); //m_backButton is a private CBitmap member of my dialog
CButton* pButton = (CButton* )GetDlgItem(IDC_BUTTON1);
pButton->SetBitmap(m_backButton);
It results in an IntelliSense-Error:
IntelliSense: class "CButton" has no member "setBitmap"
Another try was to use sendMessage:
m_backButton.Attach (LoadBitmap (AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_BACK_BUTTON)));
CButton* pButton = (CButton* )GetDlgItem(IDC_BUTTON1);
HBITMAP hBitmap = (HBITMAP)m_backButton;
pButton->SendMessage(BM_SETIMAGE,(WPARAM)IMAGE_BITMAP,(LPARAM)hBitmap);
First i got another IntelliSense-Error:
IntelliSense: identifier "BM_SETIMAGE" is undefined
Like i've read in another post, i defined "BM_SETIMAGE" by my own:
#define BM_SETIMAGE 0x00F7
Now the code is able to compile, but the button still shows no bitmap... Since every post in the internet uses one of this two solutions i'm helpless. Anybody an idea whats wrong? And if not, also thank you for reading:)