I'm trying to figure out how to use the Windows API function PathCompactPath. It needs a handle to a device context (hDC) in addition to a pixel length to which a path string is shortened, where the device context contains information about the font size, font face etc. that is used for the length calculation.
If I have a window handle (hWnd) to a label, how can I properly get a device context which contains the font information with which this label was created? GetDC seems to discard this information for normal window handles.
I'm writing a C++ DLL for use with VB6, so the hWnd would come from a VB6 control. However, I think my question applies to the general case (a label in a C++ form) as well.