Download source code

My previous article demonstrates the use of the IImagingFactory interface to enumerate the installed encoders and decoders. The above interface can be used to load any supported image file. The CreateImageFromFile method can be used to load an image from file. The syntax of the method is:

HRESULT CreateImageFromFile(const WCHAR* filename,IImage** image);

The filename parameter is the name of the file to load and the image parameter is an out parameter and will be filled with a pointer to IImage interface. The Draw method of the IImage can be used to draw image on a device context.

The sample application displays all the images from the “My Pictures” folder of the device. You can move forward and backward using the toolbar buttons.