GetTextExtentPoint32 Doesn't Take Account of the Current Font
<p>I need to find the width of a string with any font. However, when I use <code>GetTextExtentPoint32</code>, it doesn't take the account of the current font. This is my code:</p>

<pre><code>HFONT hFont = CreateFont(36, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET, 
    OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, NULL);

SelectObject(GetDC(m_hSettingsWnd), hFont);
GetTextExtentPoint32(GetDC(m_hSettingsWnd), TITLE_TEXT, wcslen(TITLE_TEXT), &amp;sTextSize);
// TITLE_TEXT is the string I'm trying to get the width of.
</code></pre>

<p>Could anybody correct the formatting as well, please? I'm new to Stack Overflow and the code sample isn't working properly for me.</p>