Solved

HBITMAP DDB to DIB.

Posted on 2004-03-24
2
1,309 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
matchUp  challenge 6 53
mapBully challenge 6 115
Path of Workbook 3 62
Trying to run powershell  in a batch file. How do I do this? 8 68
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

863 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now