Jump to content
  • Advertisement

Archived

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

rangler

GDI GetDCBrushColor()

This topic is 5277 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

Hi, I was wondering how you access GetDCBrushColor(). I wan''t to use it to get the color of my window. If you know an easier way to do this I''d love to hear it. I''ve included windows.h but it doesn''t seem to work. For some reason MSDEV pops up a message telling you how to use it but compiles with errors.

Share this post


Link to post
Share on other sites
Advertisement
That seems to be the best way to do it. The function only takes one argument which is the HDC for the window and returns a COLORREF. Seems pretty easy to me.

Share this post


Link to post
Share on other sites
Yes thats my problem I should be able to use ut but I get to following compiler error:

error C2065: ''GetDCBrushColor'' : undeclared identifier

Share this post


Link to post
Share on other sites
Did you #define _WIN32_WINNT to be greater than or equal to 0x0500?


Thanks Salsa!Colin Jeanne | Invader''s Realm
"I forgot I had the Scroll Lock key until a few weeks ago when some asshole program used it. It even used it right" - Conner McCloud

Share this post


Link to post
Share on other sites
That tells the compiler your app will be used on Win2000 and above or Win98 and above (and WILL NOT run on older windows versions). This command (GetDCBrushColor) is only available in later Windows versions.

In your project settings, open preprocessor, top line, enter WINVER = 0x0410 (if it''s lower than that).

Share this post


Link to post
Share on other sites
quote:
Original post by rangler
no i did not. im new to win32 programming. how do i do that and why is it important

Simply write

#define _WIN32_WINNT 0x0500

before you include windows.h


Thanks Salsa!Colin Jeanne | Invader''s Realm
"I forgot I had the Scroll Lock key until a few weeks ago when some asshole program used it. It even used it right" - Conner McCloud

Share this post


Link to post
Share on other sites
You cannot use GetDCBrushColor() then. Instead use GetObject() to get a LOGBRUSH representing the currently selected brush. You can get color information from the LOGBRUSH structure.


Thanks Salsa!Colin Jeanne | Invader''s Realm
"I forgot I had the Scroll Lock key until a few weeks ago when some asshole program used it. It even used it right" - Conner McCloud

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!