I got a handle of dc (of the type HDC ) under Windows. Can I get the type of that cd(memory dc, window dc ,printer etc.) with Windows APIs?
This is in general not possible, and usually not necessary either. A device context is meant to abstract the underlying implementation.
Occasionally, however, it is helpful to know, where the contents of a device context are displayed, to adjust rendering, for example. Calling GetDeviceCaps with nIndex set to TECHNOLOGY
retrieves that information. This doesn't allow you to discern between all four Device Context Types plus their subtypes, though.