Solved

HBITMAP DDB to DIB.

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

772 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

10 Experts available now in Live!

Get 1:1 Help Now