title: how to create a pen that is the same color as that of a solid brush?
body: <p>I would like to get the color (colorref) of a SolidBrush to create a pen of the same color, using only Windows API functions (no dot net and stuff like that) using C/C++/Asm/Delphi, etc.</p>
  
  <p>If it helps, this is what I'm trying to accomplish: I've drawn a curve using PolyLine in a resizable window.</p>
  
  <p>Letting Windows clear the background every time the window is resized causes a very noticeable amount of flicker.  To reduce the flicker to a minimum, I can get the background brush that Windows is using to clear the window (GetClassLongPr) and, create a pen of that same color to redraw just the curve with that pen, effectively erasing it without clearing the entire client area (which is what causes the flicker.)  Of course, I cannot create that pen unless I find a way to get the colorref from the brush handle returned by GetClassLongPtr.</p>
  
  <p>I can't figure out how to create a pen that is of the color used by the solid brush windows uses to erase the client area. </p>
  
  <p>NOTE: I am aware that another way of solving the flicker problem is to create a clipping region to cause just the curve to be erased but, region handling is much slower than simply redrawing the curve with a pen set to the background color. </p>
  
  <p>After this long story, the question is: how do I create a pen that is the same color as that of the solid brush used to erase the window client area ?</p>
  
  <p>Thank you.</p>