Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

HBITMAP DDB to DIB.

Posted on 2004-03-24
2
Medium Priority
?
1,344 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 400 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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.
Ready to get certified? Check out some courses that help you prepare for third-party exams.
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 …

618 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