I'm trying to display images with overlays in a 'CListCtrl' within an MFC dialog box. The list control is in report/details mode.
I cannot find good documentation for showing overlays on some of my item images.
The code that is failing is shown below. I have a 64x32 bitmap with a folder icon in the first 32x32 pixels, and an overlay image in the second 32x32 pixels (IDB_FOLDERS32_OVERLAY). The bitmap has transparencies that seem to work fine.
CBitmap bm;
bm.LoadBitmap(IDB_FOLDERS32_OVERLAY);
m_ImageList.Create(32, 32, ILC_COLOR32, 2, 1);
int index = m_ImageList.Add(&bm, RGB(0, 0, 0));
ASSERT(index >= 0);
m_ImageList.SetOverlayImage(index, 2);
The last line returns 0, which indicates an error. GetLastError() returns 6 (ERROR_INVALID_HANDLE).
I can't for the life of me find reasonable documentation for how to do this anywhere on the web. Can anyone see what I'm missing?
ILC_COLOR32might not be enough, it might needILC_MASKas well. - Jonathan PotterILC_MASKflag results in the method returning 1 instead of 0. But the documentation is still horrible even for the Windows API services. Guess I'll spend another day trying to figure out how to correctly create my mask. Then again, I think it might make much more sense to simply have two images, one with the overlay already applied. Don't know why I would want to spend days trying to figure how overlays work. - Jonathan WoodILC_MASKis required in this instance. - Jonathan Potter