• Advertisement

Archived

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

SetDCPenColor not found

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

Hello, everyone. I have a problem that's driving me nuts, and any help would be greatly appreciated. I'm trying to use this bit of code to change colors when drawing shapes:
SelectObject(memDC, GetStockObject(DC_PEN));
SelectObject(memDC, GetStockObject(DC_BRUSH));

SetDCPenColor(memDC, RGB(255,255,255));
SetDCBrushColor(memDC, RGB(128,128,128));
 
Now, from everything I've read in the help, this should work. I have windows.h included, and the gdi32.lib file is 'inherited' (if this is the correct term), and I'm running Windows XP. According to the help, that's all you need to be able to use SetDCPenColor and SetDCBrushColor. The little helpbox will even appear when you hover over the function name. The problem is, when I try to compile, Visual Studio .NET 2003 can't seem to find DC_PEN, DC_BRUSH, SetDCPenColor, or SetDCBrushColor! This is very strange to me, since it obviously knows about them... I've tried searching the net for help on this for a few hours last night, and haven't found ANY information on using these functions. Anyone know what's going on, and more importantly how to fix it? [edited by - Robert Kulp on May 9, 2004 12:55:00 PM]

Share this post


Link to post
Share on other sites
Advertisement
#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
Thanks Invader X! That seemed to fix it.

From what I could gather looking through the wingdi.h, it wouldn''t define DS_PEN or the rest if _WIN32_WINNT wasn''t defined, or something like that...

Just out of curiousity, why is that condition there? And by declaring _WIN32_WINNT myself, is there danger of opening new errors down the road?

Share this post


Link to post
Share on other sites
Those constants and functions only exist with Windows NT version 5.00 or greater (that is, Windows 2000 and above). There are there are few more constants like this.


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

[edited by - Invader X on May 9, 2004 11:47:45 PM]

Share this post


Link to post
Share on other sites

  • Advertisement