Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 150663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:19:34+00:00 2026-05-11T09:19:34+00:00

EDIT: I’ve offered a bounty, since I doubt I’ll be getting any answers otherwise.

  • 0

EDIT: I’ve offered a bounty, since I doubt I’ll be getting any answers otherwise.

Lately I’ve been working with listviews and I’ve decided to add an icon for each item indicating whether it’s input or output. The icons add fine, but they’re not transparent:

Example of icon not being transparent

As can be seen, the icons are clearly not transparent. I’m currently doing something like this load the icons:

  hImageList = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 2, 2);   if (hImageList != NULL)   {     iIN  = ImageList_AddIcon(hImageList, LoadIcon(hInstance, MAKEINTRESOURCE(101)));     iOUT = ImageList_AddIcon(hImageList, LoadIcon(hInstance, MAKEINTRESOURCE(102)));   } 

I’ve tried messing with the flags for ImageList_Create & LoadIcon/LoadImage but have had no luck and to be honest I’ve run out of ideas.

Any help would be very appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T09:19:35+00:00Added an answer on May 11, 2026 at 9:19 am

    First up, ImageList_ReplaceIcon copies the icon data when adding it to an image list. So the HICON needs to be released afterwards.

    Next, imagelists are natively bitmaps, not icons. And the way you are creating your imagelist makes the conversion of icon to bitmap very ambiguous. ILC_COLOR32 implies the imagelist should be created as a 32bit dib section, which typically contain transparency information via an embedded alpha channel. ILC_MASK instead implies that the internal bitmaps are DDB bitmaps, with the transparency information stored as a 1bpp mask bitmap.

    The quickest solution to your problem – take your two icons:

    • Merge them into a single bitmap resource thats 32 pels wide by 16 high. Fill the background with a mask color :- purple or something.
    • Create the bitmap using ILC_COLOR|ILC_MASK
    • Load the bitmap being sure NOT to use LR_TRANSPARENT.
    • Add the bitmap using ImageList_AddMasked passing in a COLORREF that represents the mask color.

    OR, for a better visual effect…

    • export your PNG data as a 32×16 32bpp bitmap file containing pre-multiplied alpha channel data.
    • Create the imagelist using the ILC_COLOR32 value.
    • LoadImage() with LR_CREATEDIBSECTION to load the bitmap as a 32bpp dib section.
    • Add the image using ImageList_Add()

    (the last option is kind of tricky as the number of tools that support writing out 32bit bmp files with properly pre multiplied alpha channels is rather low).


    Edited to add the following code sample. Using a 4bpp bitmap created in the dev environment this works just great :-

    HWND hwndCtl = CreateWindowEx(0,WC_LISTVIEW,TEXT('ListView1'),WS_CHILD|WS_VISIBLE|WS_HSCROLL|WS_VSCROLL,0,0,cx,cy,hWnd,(HMENU)101,hModule,NULL); HBITMAP hbm = (HBITMAP)LoadImage(hModule,MAKEINTRESOURCE(IDB_BITMAP1),IMAGE_BITMAP,0,0,0); COLORREF crMask=RGB(255,0,255); HIMAGELIST himl = ImageList_Create(16,16,ILC_COLOR|ILC_MASK,2,0); ImageList_AddMasked(himl,hbm,crMask); ListView_SetImageList(hwndCtl,himl,LVSIL_NORMAL); 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT: Duplicate of Should Entity Framework Context be Put into Using Statement? I've been
EDIT 2 Okay, based on the advice on the answers below I eliminated my
--EDIT-- I believe this is a valid question that may have multiple answers (as
EDIT: Thank you so much for your answers, you really amaze me with so
EDIT: after reading the answers below and looking at all the guides i am
EDIT: Since you are asking for specifics, consider a photo-sharing site (like Flickr or
EDIT: had to retag this, because, it's rather a Sweave / R question since
EDIT: Now a Major Motion Blog Post at http://messymatters.com/sealedbids The idea of rot13 is
EDIT: I used, finally, inotify. As stefanB says, inotify is the thing to use.
EDIT 1 I apologize but after reading the 2 suggested articles I still don't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.