Announcement

Collapse

Maintenance

The forum could be offline for 30-60 minutes in the very near future for maintenance (said 3pm Pacific). I was behind on getting this notice. I do apologize.
See more
See less

ASCII

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ASCII

    Other than capturing the image in a dos-session, is there any way to display the ASCII characters below decimal 32 and above decimal 127?


    ------------------
    Walt Decker

  • #2
    Walt --

    This is strictly a function of which characters are supported by each Windows font; it's not a problem that is specific to PB/CC or PB/DLL programs.

    If you are using PB/CC, try changing the console font from "bitmap" or "raster" to "TrueType". Or vice versa... I forget which one does not support all 256 characters. Also, under certain circumstances you may need to change the console font before the characters are displayed.

    If you are using PB/DLL, you'll need to use a font that supports all of the characters you need.


    -- Eric

    ------------------
    Perfect Sync: Perfect Sync Development Tools
    Email: mailto:[email protected][email protected]</A>



    [This message has been edited by Eric Pearson (edited January 14, 2001).]
    "Not my circus, not my monkeys."

    Comment


    • #3
      Walt --
      Use %OEM_FIXED_FONT (Terminal) or TTF "Lucida Console" (more nice, but 0-31 + not sure about W95).
      Code:
         #Compile Exe
         #Register None
         #Dim All
         #Include "WIN32API.INC"
      
         CallBack Function DlgProc
            Select Case CbMsg
               Case %WM_PAINT
                  Dim hDC As Long, hFont As Long, i As Long, j As Long
                  hdc = GetDC(CbHndl)
                  Local lf As Logfont, lResult As Long
                  lResult = GetStockObject(%OEM_FIXED_FONT)
                  GetObject lResult, SizeOf(lf), ByVal VarPtr(lf)
                  ' change height/width
                  hFont = CreateFontIndirect(lf)
                  SelectObject hDC, hFont
                  Dim z As String * 16
                  For i = 0 To 15
                     For j = 0 To 15
                        Mid$(z, j + 1, 1) = Chr$(i * 16 + j)
                     Next
                     TextOut hdc, 0, lf.lfHeight * i, ByVal VarPtr(z), 16
                  Next
                  ReleaseDC CbHndl, hDC
                  DeleteObject hFont
             End Select
          End Function
      
          Function PbMain
             Local hDlg As Long
             Dialog New 0, "OEM",,, 200, 200, %WS_CAPTION Or %WS_SYSMENU To hDlg
             Dialog Show Modal hDlg Call DlgProc
          End Function
      ------------------
      E-MAIL: [email protected]

      Comment


      • #4
        DOS uses an extended ASCII character set, also referred to as the
        OEM character set. The characters above 127 are locale-dependent
        (they may differ in different countries). In Windows, you are most
        likely to use the ANSI character set, which is similar but not
        identical. To translate from one to the other, use the Windows API
        functions OemToChar and CharToOem. It is not always possible to do
        a perfect translation from one character set to the other. This
        depends, in part, on the Windows font involved, as some fonts are
        more ANSI-compliant than others.

        ------------------
        Tom Hanlin
        PowerBASIC Staff

        Comment

        Working...
        X