Solved

HBITMAP DDB to DIB.

Posted on 2004-03-24
2
1,317 Views
Last Modified: 2013-11-20
Hi,

    Can somebody show me some sample code on how I can get the pixel bits from a HBITMAP using GetDIBits()?

How can I get the height and width of the image given a HBITMAP?

Thanks a lot.
0
Comment
Question by:limin123
[X]
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
2 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 100 total points
ID: 10670314
>Can somebody show me some sample code on how I can get the pixel bits from a HBITMAP using GetDIBits()?

Converting DDB to DIB
http://www.codeguru.com/Cpp/G-M/bitmap/article.php/c1765/

>How can I get the height and width of the image given a HBITMAP?

BITMAP bmp;
VERIFY(::GetObject(hBmp, sizeof(BITMAP), &bmp) == sizeof(BITMAP));

// bmp.bmWidth, bmp.bmHeight
0
 
LVL 5

Expert Comment

by:info_expert
ID: 10670589
Hi,
Ok here is the more specific answer,
BITMAP is a structure, having fields such as bitmap.bmWidth and bitmap.bmHeight

BITMAP bitmap;
GetObject (hBitmap, sizeof (BITMAP), &bitmap) ;

By calling this, your BITMAP structure is filled by the information of bitmap.

now you can compare its fields for any purposes. e.g.  bitmap.bmWidth==50  or so.

If you need further simplifications and help , you are welcomed.

Regards.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

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 …
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

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