Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.

SpazBoy the Mitey

Can I read the BPP of a display in WIN32?

This topic is 5957 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am writing a resolution changing thing that uses WIN32 API calls to change the res, and then uses its destructor to change back again. Is there an API function I can call that gives me the display''s BPP? Also I am currently using GetSystemMetrics to determine the width/height of the screen. Is that right? god I hate being a newbie again

Share this post

Link to post
Share on other sites
I think the following code is what you are looking for...

int bpp;
HDC screenDC;

// get the current screen resolution

int screenWidth = GetSystemMetrics(SM_CXSCREEN);
int screenHeight = GetSystemMetrics(SM_CYSCREEN);

// get the screen DC for our current display and it''s BPP

screenDC = GetDC(NULL);
bpp = GetDeviceCaps(screenDC,BITSPIXEL);

The value returned in bpp is the value you are looking for, e.g. 8, 16, 24 or 32.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!