String with underline

How do i compose a string ( sprintf ) with underlined text ?
AndersCarlssonAsked:
Who is Participating?
 
rbrConnect With a Mentor Commented:
This is impossible in plain C. Underlinded text is a special font or character attribute. For which OS do you need this.
0
 
AndersCarlssonAuthor Commented:
I need this for a program in a NT system.
0
 
ozoCommented:
<u>and for what kind of display device?</u>
0
 
AndersCarlssonAuthor Commented:
I want it for a string in a MessageBox, in a Windows applikation.
0
 
alexoCommented:
Message boxes cannot display underlined text.

Create a custom dialog with a static text control, and in the WM_INITDIALOG handler of said dialog create an underlined font and set it as the control's font.

Something like that:

    LOGFONT font = { 0 };
    HFONT   hFont;

    font.lfUnderline = TRUE;
    font.lfPitchAndFamily = VARIABLE_PITCH | FF_ROMAN;
    hFont = CreateFontIndirect(&font);
    SendDlgItemMessage(hwnd, IDC_TEXT, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));

0
All Courses

From novice to tech pro — start learning today.