Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Converting a CPicture to a CBitmap

Posted on 1998-05-20
Medium Priority
Last Modified: 2013-11-20
I am retreiving a CPicture from an OCX control.  I need to turn it into a CBitmap and I am having problems.  I use CBitmap::FromHandle(HANDLE) using the CPicture::GetHandle(), but the header is corrupted and the image is off by several bytes.  
Question by:twain052098
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

galkin earned 400 total points
ID: 1313569
Try this.

LPPICTURE lpPicture;
CBitmap bm;
if(SUCEEDED(m_lpDispatch->QueryInterface(IID_IPicture, (LPVOID *)&lpPicture)))
lpPicture->get_Handle((OLE_HANDLE *)&hbm);

Author Comment

ID: 1313570
Great Thanks for the help.  Convertion of the m_lpDispatch was the trick.  Thanks!

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question