I'm trying to create a function that generates a dialog containing a prompt and an edit box that, much like MessageBox, is sized proportionally to the prompt.
I've been using GetTextExtentPoint32, but that always gives me a width that's nearly twice the size of the actual prompt. Of course, it's being used at the point of creation of the window, so I'm having to get the desktop's DC and do it there. The desktop DC for some reason doesn't seem to have the standard dialog font as its default font, so I'm assuming it's getting this massive value through its use of the standard System font.
I suppose it could be done in WM_INITDIALOG, but that would be more complicated as I would have to retrieve the caption text, resize all of the controls, etc.
Is there a better way?