June 29th, 2004, 06:27 AM
Anyone know about the DC_PEN?
A search of DC_PEN on this site comes up empty.
My compiler gives me an unknown reference for DC_PEN and the function
// oldcolor = SetDCPenColor(hdc, shadow);
I suppose all the other related functions suffer the same plight.
It's supposed to be in the gdi32.lib which I have but I guess not.
I was hoping that DC_PENs and DC_BRUSHes would be a much more efficient way of changing colors than the usual method.
My docs say that it is subject to change. Anyone have updated info on these stock objects?
June 29th, 2004, 06:47 AM
Have you included header: afxwin.h???
and this is what the help says:
So you don't need 2 parameters.... I hope this helps a little bit....
CDC Overview | Class Members | Hierarchy Chart | CDC::GetDCPenColor
Sets the current device context (DC) pen color to the specified color value.
Specifies the new pen color.
Nonzero if the function is successful; otherwise 0.
June 29th, 2004, 07:08 AM
I think he wants to call the global
Here obviously 2 parameters are required.
::SetDCPenColor( HDC hDC, COLORREF cr )
check your stdafx.h for the value of _WIN32_WINNT.
if its set to 0x0400, and you are using w2k or higher,
change it to 0x0500 and see waht happens.
Some Functions in GDI32 such as
SetDCPenColor and SetDCBrushColor are only defined for
_WIN32_WINNT >= 0x0500
Hope this helps,
June 29th, 2004, 07:43 AM
You were right about the setting. Its for NT 4.0. I have not tried changing it yet. Do you know if Windows XP supports that function? From what I have read about it it appears to be much more efficient, but there is no text in the documentations that say it is; it's just easier to code. But I am much more interested in efficiency. It would seem that there must be a lot of overhead in Creating, Selecting, and Deleting pen and brush objects just for something as trivial as changing a color.
I take it the other function with a single parameter is from MFC (which I know nothing about)?
June 29th, 2004, 07:55 AM
Definiteley, just tried it.
Originally posted by Gyannea
Do you know if Windows XP supports that function?
On efficieny or performance i can say nothing, but i suppose it's a little more faster than selecting the stock-objects, but that depends completeley on the implementation of the functions where we cannot look into ( unfortunateley ).
The other function (with the 2 parametrs) is indeed from MFC, but does nothing else, as emulating the SDK-function in the CDC-Object.
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.