Enumerate WIC Components

In an older article, I presented a function that enumerates Windows Imaging Component codecs. Recently I had the idea to make a set of WIC Interfaces wrapper classes for easily enumerate and get info about all types of WIC components: bitmap decoders and encoders, metadata readers and writers, format converters, and supported pixel formats. Here are just few samples of code.

CComponentEnumT – a template class for enumerating WIC components

CComponentInfoBaseT – base class for all other component info classes

CPixelFormatInfoT – just one of classes getting WIC component info

Just note that, for further easier using, I’ve defined here CPixelFormatInfo, an alias for CPixelFormatInfoT<IWICPixelFormatInfo2>.

CComponentEnumT specializations and aliases

Finally, let’s see how to use these classes!

Enumerating WIC pixel formats

Quite easy, isn’t it?

Get the pixel format info

You can find the complete source code in the attached demo solution.

Demo solution

Download: Enumerate WIC Components - Demo Solution.zip (72)

Enumerate WIC Components - Demo

Enumerate WIC Components – Demo

The demo solution contains an MFC and a console project that use the classes described above in order to enumerate WIC components and get info about each one. The MFC one allows choosing the component type(s) as well as enum options (include the disabled components or enum only Windows built-in components). The console application is simpler and I wrote it just to demonstrate that my little library of wrapper classes can be used both in MFC and non-MFC applications.

Notes

  • I hope, this article can be useful.
  • If you have any observation or remarks, please do not hesitate to post a reply!

Resources and related articles

Leave a Reply