Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

String with underline

Posted on 1999-01-20
5
262 Views
Last Modified: 2010-04-15
How do i compose a string ( sprintf ) with underlined text ?
0
Comment
Question by:AndersCarlsson
5 Comments
 
LVL 10

Accepted Solution

by:
rbr earned 50 total points
ID: 1258196
This is impossible in plain C. Underlinded text is a special font or character attribute. For which OS do you need this.
0
 

Author Comment

by:AndersCarlsson
ID: 1258197
I need this for a program in a NT system.
0
 
LVL 84

Expert Comment

by:ozo
ID: 1258198
<u>and for what kind of display device?</u>
0
 

Author Comment

by:AndersCarlsson
ID: 1258199
I want it for a string in a MessageBox, in a Windows applikation.
0
 
LVL 11

Expert Comment

by:alexo
ID: 1258200
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

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question