No announcement yet.

GetTextExtentPoint32, pixels or logical units?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Egbert Zijlema
    Thanks, Chris!

    Obviously my mapping mode is "pixels", because on my own computer my dialogs don't look weird. But from now on I'll force the MM_TEXT mode, just to be sure. Did not know that. Thank you very much!

    Leave a comment:

  • Chris Boss
    Logical units means that it depends upon the DC.

    DC's have a mapping mode.

    The SetMapMode API function is used to set the current mapping mode of a DC. The %MM_TEXT flag means logical units are pixels.

    If an API function says it returns the coordinates as logical units, the return value depends upon the current mapping mode.

    Many times the default mapping mode is MM_TEXT, which is pixels, but you may want to force the mapping mode to MM_TEXT before you call GetTextExtentPoint32 if you want pixels.

    Leave a comment:

  • GetTextExtentPoint32, pixels or logical units?

    I was re-reading SDK-information on the API function GetTextExtentPoint32. It states:

    [out] Pointer to a SIZE structure that receives the dimensions of the string, in logical units.

    I always was thinking that my apps, in which I use this function, were calculating pixel sizes. Qestion: what exactly are logical units? And how do I convert 'm to pixels?