Creating the CBitmapPicture Object

      

Environment:

CBitmapPicture is derived from CBitmap. It allows the user to load jpg, gif, bmp, and dib formats from a file or from the resouce and store them as a CBitmap object.

Public Operations

  • Load from file given supplied path
  • BOOL Load(CString sFilePathName);
  • Load from resouce; give ResourceName and Type
  • BOOL Load(UINT ResourceName, CString ResourceType);
  • Display CFileDialog and choose from supported image types
  • BOOL SelectFileAndLoad();

CBitmapPicture uses the IPicture interface just as Internet Explorer does to load jpg and gif files. The IPicture interface is then converted to a bitmap interface.

CBitmpaPicture utilizes code from:
class CPicture—Author: Dr. Yovav Gad, EMail: Sources@SuperMain.com, Web: www.SuperMain.com
function LoadBMPImage—Author: Zafir Anjum

Example Usage

  • Load a job from resource; then Select it into CStatic Image object m_Display
  • Picture.Load(IDR_JPG_SPACE31,"JPG")
    m_Display.SetBitmap((HBITMAP)Picture.GetSafeHandle());
  • Select and Load file; then Select into CStatic Image object m_Display
  • if(Picture.SelectFileAndLoad())
    m_Display.SetBitmap((HBITMAP)Picture.GetSafeHandle());

Downloads

Download demo project and source files - 1.15 Mb


Comments

  • requarements to run this code?

    Posted by Joe on 06/22/2012 10:30am

    You could at least tell us in which library are this functions. I tried to compile yours program on gcc and I got plenty of errors. C:\Users\amd\Downloads\CBitmapPicture\stdafx.h|15|error: afxwin.h: No such file or directory|

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

  • Live Event Date: November 13, 2014 @ 2:00 p.m. ET / 11:00 a.m. PT APIs can be a great source of competitive advantage. The practice of exposing backend services as APIs has become pervasive, however their use varies widely across companies and industries. Some companies leverage APIs to create internal, operational and development efficiencies, while others use them to drive ancillary revenue channels. Many companies successfully support both public and private programs from the same API by varying levels …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds