I recently blogged about one of the sessions I’m presenting at ESC East on application development, and showed the ~30 lines of managed code needed to pull an RSS feed from Frameit.live.com, parse the XML, and then pull and display images from the feed.
I got a couple of e-mails asking for the code needed to use the native code Win32 imaging APIs to load and display an image – here’s the code.
IImagingFactory *pImgFactory = NULL;
IImage *pImage = NULL;
// Initialize COM and Imaging API
// Load an image from the file system
// Draw the image to fit the size of the client area
// This is from the WM_PAINT handler in wndproc
hdc = BeginPaint(hWnd, &ps);
// Get Client Area Dimensions
IImage *pThumbImage = NULL;
// Scale the image to fit the client area
// Draw the thumbnail.
Note that this isn’t the full program, just the snippets needed to get this to work.
Once ESC East is done I will post the rest of the code.