I use both client device contexts (hDc) and memory device contexts (hMemDc) for drawing.
I retrieved a handle for a stock object, hPen = GetStockObject(DC_PEN) and inadvertantly selected the same pen handle into both DC's:
Apparently, the pens remained independant. I could change the two pens to two different colors, eg, SetDCPenColor(hDc, 0x0000FF); and SetDCPenColor(hMemDc, 0x00FF00);
Using the two pens in their respective DC's, later in the code, the pens retain their individual colors.
Was this just luck that it worked? Should the pens for each DC have their own own unique handles?
Or do pens become unique once selected into a DC?