CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2002
    Location
    Candia, NH
    Posts
    374

    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?

    Brian

  2. #2
    Join Date
    Nov 2003
    Posts
    2,185
    Have you included header: afxwin.h???

    and this is what the help says:

    Code:
    CDC::SetDCPenColorSee Also
    CDC Overview | Class Members | Hierarchy Chart | CDC::GetDCPenColor
    Sets the current device context (DC) pen color to the specified color value.
    
    COLORREF SetDCPenColor(
       COLORREF crColor
    );
    Parameter
    crColor 
    Specifies the new pen color. 
    Return Value
    Nonzero if the function is successful; otherwise 0.
    So you don't need 2 parameters.... I hope this helps a little bit....

  3. #3
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    153
    I think he wants to call the global
    Code:
       ::SetDCPenColor( HDC hDC, COLORREF cr )
    Here obviously 2 parameters are required.

    //
    Gyannea,

    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,
    Matze

  4. #4
    Join Date
    Dec 2002
    Location
    Candia, NH
    Posts
    374
    Matze42,

    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)?

    Brian

  5. #5
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    153
    Hi Brian,
    Originally posted by Gyannea
    Do you know if Windows XP supports that function?
    Definiteley, just tried it.

    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.

    Matze

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured