Is there's a function that can draw text and fit it inside a rectangle (the function will make the size of the text smaller as appropriate to make it fit or something).
I checked the parameters for DrawText() but I don't think it supports such a feature.
Maybe you can use GetTextMetrics to check if the text fits inside the rectangle, and if it doesn't, reduce the current font size and repeat the measurement.
GetTextMetrics:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd144941%28v=vs.85%29.aspx