Some callback structures for drawing operations contain two device contexts. Both are identical and kept only for backward compatibility reasons.
If you select a GDI object in this DC or make other changes, e.g. change the mapping mode, you should reverse the changes before ending the routine.
Tip: the Windows API functions SaveDC(), RestoreDC() can help considerably for complex changes.