#### Archived

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

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

## 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 on other sites
#define _WIN32_WINNT to be greater than or equal to 0x0500

"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 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 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.

"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]

1. 1
Rutin
32
2. 2
3. 3
4. 4
5. 5

• 13
• 9
• 9
• 9
• 14
• ### Forum Statistics

• Total Topics
633318
• Total Posts
3011339
• ### Who's Online (See full list)

There are no registered users currently online

×