Ah, well you can use a different function for that
GetTextExtentPoint32.
I make use of this for position messages like Author: text messages which use different colors. However, I do not use this for rendering text within a menu. I am confused because I cant imagine when you'd want to do this (aside from the height, maybe, but there are better solutions to that even) with menus.
A menu should have a position (x,y) and a width/height to them. So when you want to check for the width of your rect to draw, it should be 80% of your menu width, and likewise any rules you have for heights. You do not need to compute all this extra stuff. Simply but the bottom of the rect at the desired level and it will not render text beyond that point (not sure if you need to remove the NOCLIP flag).
For example:
int x = menu.x + menu.width * 0.1f;int y = menu.y + 15; //for the title, whatever size you needdrawText(x, y, menu.width * 0.8f, "hey this is a string!");