I'm using VS [C++] 2008 Express (no MFC). I've been trying all day to get a toolbar onto my app that uses a .bmp file for the icons. The code I've used to do this is:
Code:
// Load toolbar bitmap. (48 pixel wide, 16 high) HBITMAP hbmTool = (HBITMAP)LoadImage(g_mainhInstance, "tool.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_LOADMAP3DCOLORS); // blah blah, setup buttons.. HWND hWnd = CreateToolbarEx(g_mainWinHandle, WS_CHILD | WS_VISIBLE, IDTB_MAIN, 3, NULL, (UINT)hbmTool, tbButtons, 3, 16, 16, 16, 16, sizeof(TBBUTTON));
I've literally been googling this problem all day trying to find out how I resolve this to the point I now have a headache. X( I realise I need to be using TransparentBlt and/or BitBlt. I had no luck with TransparentBlt, but this is as far as I've got using BitBlt:
Code:
HBITMAP hbmTool = (HBITMAP)LoadImage(g_mainhInstance, "tool2.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_LOADMAP3DCOLORS); HDC hdcTool, hdcNew; hdcTool = CreateCompatibleDC(0); SelectBitmap(hdcTool, hbmTool); HBITMAP hbmNew = CreateBitmap(48, 16, 1, 1, NULL); hdcNew = CreateCompatibleDC(0); SelectBitmap(hdcNew, hbmNew); SetBkColor(hdcTool, (COLORREF)RGB(130, 255, 255)); // This is the background color of the tool.bmp BitBlt(hdcNew, 0, 0, 48, 16, hdcTool, 0, 0, SRCCOPY); // .. tidy up etc
I've read every resource I can find on the net but I can't make sense of this final stage. This has become a brickwall in my learning project, I'd HUGELY appreciate any one who can take a moment out and reveal (and briefly explain if possible) this last step to me.
