[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.vb.general.discussion

How can one print CHR$(13) - (i.e. &H0D) - aka carriage return

NadCixelsyd

3/15/2011 1:29:00 PM

The DOS prompt uses the font "Terminal", AKA Code Page 437, which has
character representation for just about all 256 characters. For CHR
$(13), they list a small musical note.

I have my font set to "Terminal". I want to print that note, but when
I print CHR$(13), it goes to the next line. Is there a way to get VB6
to interpret CHR$(13) as character and not as a command to start a
newline. (And also: CHR$(9) and CHR$(10) to not tab and line-feed
respectively)
4 Answers

DaveO

3/15/2011 2:19:00 PM

0


"NadCixelsyd" <nadcixelsyd@aol.com> wrote in message
news:f1991b9a-721a-4d53-a908-a1b1564b4fad@x8g2000prh.googlegroups.com...
> The DOS prompt uses the font "Terminal", AKA Code Page 437, which has
> character representation for just about all 256 characters. For CHR
> $(13), they list a small musical note.
>
> I have my font set to "Terminal". I want to print that note, but when
> I print CHR$(13), it goes to the next line. Is there a way to get VB6
> to interpret CHR$(13) as character and not as a command to start a
> newline. (And also: CHR$(9) and CHR$(10) to not tab and line-feed
> respectively)

I suspect what they actually use is a pilcrow (¶ - Ascii 182) and not a
musical note

The easiest way is to simply replace the Ascii13 with the pilcrow like this:
Somestring = Replace(PrintString, Chr$(13), "¶")

Use the same method to replace Tab & Line feeds. Although I have no idea
what you are trying to achive, stripping out Tabs may make the result a bit
tricky for the reader to comprehend.

Regards
DaveO.


Thorsten Albers

3/15/2011 2:51:00 PM

0

NadCixelsyd <nadcixelsyd@aol.com> schrieb im Beitrag
<f1991b9a-721a-4d53-a908-a1b1564b4fad@x8g2000prh.googlegroups.com>...
> The DOS prompt uses the font "Terminal", AKA Code Page 437, which has
> character representation for just about all 256 characters. For CHR
> $(13), they list a small musical note.
>
> I have my font set to "Terminal". I want to print that note, but when
> I print CHR$(13), it goes to the next line. Is there a way to get VB6
> to interpret CHR$(13) as character and not as a command to start a
> newline. (And also: CHR$(9) and CHR$(10) to not tab and line-feed
> respectively)

AFAIK no.
For such signs you have to use a font other then "Terminal" where the glyph
you want to print isn't placed in a control code slot. Some of the control
code glyphs in "Terminal" have 'normal' ANSI character code equivalents in
e.g. "Symbol" (unfortunately there is none for CR=13).
Most of the Unicode fonts shipped with Windows include the Unicode code
points corresponding to these control code glyphs; e.g. "Courier New":

HT 09 -> Print ChrW$(&H25CB)
or Print ChrW$(&H25E6)
LF 10 -> Print ChrW$(&H25D9)
VT 11 -> Print ChrW$(&H2642)
FF 12 -> Print ChrW$(&H2640)
CR 13 -> Print ChrW$(&H266A)

--
Thorsten Albers

gudea at gmx.de

Karl E. Peterson

3/15/2011 5:30:00 PM

0

After serious thinking NadCixelsyd wrote :
> The DOS prompt uses the font "Terminal", AKA Code Page 437, which has
> character representation for just about all 256 characters. For CHR
> $(13), they list a small musical note.
>
> I have my font set to "Terminal". I want to print that note, but when
> I print CHR$(13), it goes to the next line. Is there a way to get VB6
> to interpret CHR$(13) as character and not as a command to start a
> newline. (And also: CHR$(9) and CHR$(10) to not tab and line-feed
> respectively)

What you want is OEM_FIXED_FONT.

See: http://vb.mvps.org/samples/...

--
..NET: It's About Trust!
http://vfre...


David Youngblood

3/15/2011 11:33:00 PM

0

"NadCixelsyd" <nadcixelsyd@aol.com> wrote in message
news:f1991b9a-721a-4d53-a908-a1b1564b4fad@x8g2000prh.googlegroups.com...
> The DOS prompt uses the font "Terminal", AKA Code Page 437, which has
> character representation for just about all 256 characters. For CHR
> $(13), they list a small musical note.
>
> I have my font set to "Terminal". I want to print that note, but when
> I print CHR$(13), it goes to the next line. Is there a way to get VB6
> to interpret CHR$(13) as character and not as a command to start a
> newline. (And also: CHR$(9) and CHR$(10) to not tab and line-feed
> respectively)

Print to where? AFAIK, the "Terminal" font that comes with windows is a
Screen only font, not a Printer font. If you want to print to a form or
picture box (or if you have a Printer "Terminal" font), you can print the
non-printable characters using the TextOut API. However, some of the
behavior has changed with Win7. You might look up my earlier post, regarding
non-printable characters in single line edit boxes.

David

Private Declare Function TextOut Lib "gdi32" Alias "TextOutA" ( _
ByVal hdc As Long, _
ByVal x As Long, _
ByVal y As Long, _
ByVal lpString As String, _
ByVal nCount As Long) As Long

Private Sub Form_Load()
Dim i As Long, s As String

For i = 1 To 31
s = s & Chr(i)
Next i
With Me
.AutoRedraw = True
.FontName = "Terminal"
.FontSize = 12
TextOut .hdc, 0, 0, s, Len(s)
End With

' For comparison
Print
Print
Print
Print s

End Sub