CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2007
    Posts
    127

    CreateIconIndirect and mask

    Hello! I've tried to create an icon from two gdi+ bitmaps and I can't make the icon transparent.
    Here's my code:
    Code:
    	ICONINFO iconInfo = {0};
    	iconInfo.fIcon = TRUE;
    	bmp.GetHBITMAP(Color(255,0,0), &iconInfo.hbmColor);
    	bmp2.GetHBITMAP(Color(255,0,0), &iconInfo.hbmMask);
    
    	HICON hIcon = CreateIconIndirect(&iconInfo);
    It seems that hbmMask is not set. Why?

    Bye!
    I love this forum. Thanks all for your help!

  2. #2
    Join Date
    May 2007
    Posts
    127

    Re: CreateIconIndirect and mask

    If I load the icon HBITMAPS from resource it's working.
    Code:
    iconInfo.hbmColor = LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP2));
    iconInfo.hbmMask = LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP1));
    The problem might be on Bitmap::GetHBITMAP()?
    I love this forum. Thanks all for your help!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured