Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

In dialogbox, how to use \n or \t char

Status
Not open for further replies.

wannabegood

Programmer
Mar 29, 2002
5
US
I am a beginner in win32 api programming. Could you please someone help me?

I am trying to use \n or \t, print control char, in a dialog Control edit defined as follows.

EDITDLG DIALOG 0,0,400,300
STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | 0x200L | WS_POPUP | \
WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "PS Batch Monitor Dialog"
FONT 8, "Arial"
BEGIN
CONTROL "", IDC_EDITDLG_TEXT, "edit", \
ES_LEFT | ES_MULTILINE | ES_READONLY | ES_WANTRETURN, \
8, 20, 384, 255
....

If I use the 'SetDlgItemText(hwnd, IDC_EDITDLG_TEXT, "hello \n\n THis is testing");'
it prints like this, showing '\n' as unreadable square box?

hello'unreadable square box''unreaderable square box' THis is testing

Do I use other command, not SetDlgItemText or do I have to massage it before using the command? Actually, I am using 'SetDlgItemText(hwnd, IDC_EDITDLG_TEXT, testmsg);' where testmsg comes from Unix using winsock TCP/IP and contains \n or \t character to feed lines.

Thank you very much.
 
The problem is you are trying to print characters below asc(32).
Try to do a replace(instring,"\n",vbCrLf)
replace(instring,"\t",vbTab )

Otherwise, why not remove them alltogether?
 
Thank you for the reply. I use Dev-C++, so I do not think it applies to Dev-C++.

The text that includes '\n' to do the line feed comes from the Unix thru TCP/IP, and I am trying to make the message pop up on the window when the message comes from Unix with the text properly line-fed using \n.

I am not good at C++ either, so I am looking for function to replace the '\n' with '\r\n'.

Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top