PC_PRINTER_INFO

ネイティブ デバイス コンテキスト ハンドル、およびネイティブのグラフィックス機能を直接呼び出すことによってドキュメントの印刷を強化するために使用できるその他の情報を返します。
制約事項: このルーチンは現在、UNIX プラットフォームではサポートされていません。

構文:

call "PC_PRINTER_INFO using     cblt-pi-printer-handle
                                cblt-pi-printer-info-struct
                      returning status-code

パラメーター:

cblt-pi-printer-handle
呼び出しプロトタイプ使用時 (「説明の読み方」を参照):cblt-x4-comp5
PIC:pic x(4) comp-5
cblt-pi-printer-info-struct
次を含むグループ
01 print-info-struct  
  03 cblt-pi-struct-size               cblt-os-size   *> pic x(4) comp-5 or pic x(8) comp-5 (64-bit native only). 
  03 cblt-pi-printer-hdc               cblt-pointer   *> pointer. 
  03 cblt-pi-printer-hps               cblt-os-size   *> pic x(4) comp-5 or pic x(8) comp-5 (64-bit native only). 
  03 cblt-pi-printer-orientation       cblt-x4-comp5  *> pic x(4) comp-5. 
  03 cblt-pi-printer-rows              cblt-x4-comp5  *> pic x(4) comp-5. 
  03 cblt-pi-printer-cols              cblt-x4-comp5  *> pic x(4) comp-5. 
  03 cblt-pi-printer-rows-left         cblt-x4-comp5  *> pic x(4) comp-5. 
  03 cblt-pi-printer-max-horiz         cblt-x4-comp5  *> pic x(4) comp-5. 
  03 cblt-pi-printer-max-vert          cblt-x4-comp5  *> pic x(4) comp-5. 
  03 cblt-pi-printer-min-horiz         cblt-x4-comp5  *> pic x(4) comp-5. 
  03 cblt-pi-printer-min-vert          cblt-x4-comp5  *> pic x(4) comp-5. 
  03 cblt-pi-printer-curr-horiz        cblt-x4-comp5  *> pic x(4) comp-5. 
  03 cblt-pi-printer-curr-vert         cblt-x4-comp5  *> pic x(4) comp-5. 
  03 cblt-pi-printer-copies            cblt-x2-comp5  *> pic 9(4) comp-5. 
  03 cblt-pi-printer-quality           cblt-x2-comp5  *> pic 9(4) comp-5. 
  03 cblt-pi-printer-color             cblt-x1-comp5  *> pic 99 comp-5. 
  03 cblt-pi-reserved-item1            cblt-x1-comp5  *> pic 99 comp-5. 
  03 cblt-pi-printer-device-ver        cblt-x2-comp5  *> pic 9(4) comp-5. 
  03 cblt-pi-printer-name 
    05 cblt-pi-printer-pname-size      cblt-os-size   *> pic x(4) comp-5 or pic x(8) comp-5 (64-bit native only).  
    05 cblt-pi-printer-pname           cblt-pointer   *> pointer. 
  03 cblt-pi-printer-type  
    05 cblt-pi-printer-ptype-size      cblt-os-size   *> pic x(4) comp-5 or pic x(8) comp-5 (64-bit native only). 
    05 cblt-pi-printer-ptype           cblt-pointer   *> pointer. 
  03 cblt-pi-printer-device   
    05 cblt-pi-printer-pdevice-size    cblt-os-size   *> pic x(4) comp-5 or pic x(8) comp-5 (64-bit native only).  
    05 cblt-pi-printer-pdevice         cblt-pointer   *> pointer. 
  03 cblt-pi-printer-location    
    05 cblt-pi-printer-plocation-size  cblt-os-size   *> pic x(4) comp-5 or	pic x(8) comp-5 (64-bit native only). 
    05 cblt-pi-printer-plocation       cblt-pointer   *> pointer. 
  03 p-comment
    05 cblt-pi-printer-pcomment-size   cblt-os-size   *> pic x(4) comp-5 or pic x(8) comp-5 (64-bit native only).  
    05 cblt-pi-printer-pcomment        cblt-pointer   *> pointer. 
  03 cblt-pi-printer-type   
    05 cblt-pi-printer-papersize-size  cblt-os-size   *> pic x(4) comp-5 or pic x(8) comp-5 (64-bit native only). 
    05 cblt-pi-printer-papersize       cblt-pointer   *> pointer. 
status-code
説明の読み方」を参照

入力パラメーター:

printer-handle
プリンターが開かれた場合に返されるプリンター ハンドル
cblt-pi-struct-size
構造体のサイズ
cblt-pi-printer-papersize
関連付けられたバッファーのサイズ
cblt-pi-printer-pcomment
バッファーのアドレス

出力パラメーター:

cblt-pi-printer-hdc
プリンターのデバイス コンテキストのハンドル
cblt-pi-printer-hps
予約済み
cblt-pi-printer-orientation
印刷出力の向き
1
2
cblt-pi-printer-cols
現在のフォントでの 1 ページの合計列数
cblt-pi-printer-rows_left
現在のフォントでの現在のページの左側の行数
cblt-pi-printer-max-horiz
水平軸で使用可能なグラフィックス座標の最大値
cblt-pi-printer-max-vert
垂直軸で使用可能なグラフィックス座標の最大値
cblt-pi-printer-min-horiz
水平軸で使用可能なグラフィックス座標の最小値
cblt-pi-printer-min-vert
垂直軸で使用可能なグラフィックス座標の最小値
cblt-pi-printer-curr-horiz
現在のグラフィックス X 座標
cblt-pi-printer-curr-vert
現在のグラフィックス Y 座標
cblt-pi-printer-copies
部数
cblt-pi-printer-quality
プリンターの設定品質。値は、次のいずれかになります。
0 下書き
1
2
3
4 プリンターのデフォルト
上記以外の場合は、DPI が返されます。
cblt-pi-printer-color
プリンターのカラー機能
0 モノクロ
1 カラー
cblt-pi-printer-version
プリンター ドライバーのバージョン番号
cblt-pi-printer-pname-size
プリンター名のサイズ
cblt-pi-printer-pname
プリンター名へのポインター
cblt-pi-printer-ptype-size
プリンターの種類のサイズ
cblt-pi-printer-ptype
cblt-pi-printer-type へのポインター
cblt-pi-printer-pdevice-size
プリンター デバイスのサイズ
cblt-pi-printer-pdevice
プリンター デバイスへのポインター
cblt-pi-printer-plocation-size
プリンターの場所のサイズ
cblt-pi-printer-plocation
プリンターの場所へのポインター
cblt-pi-printer-pcomment-size
プリンターのコメントのサイズ
cblt-pi-printer-pcomment
プリンターのコメントへのポインター
cblt-pi-printer-papersize-size
プリンターの用紙サイズのサイズ
cblt-pi-printer-papersize
プリンターの用紙サイズへのポインター
status-code
プリンター処理ルーチンの戻りコード

説明:

cblt-pi-printer-type はプリンターの種類を指定します (HP や Canon など)。

cblt-pi-printer-device はプリンター デバイスを指定します (lpt1::file:com1 など)。このパラメーターは複数のデバイスに設定できます。その場合、各デバイスはカンマで区切ります (例:lpt1:,lpt2:)。

cblt-pi-printer-comment はプリンターに関連付けられるコメントを指定します (たとえば、「アカウント用プリンター」というコメントをプリンターに定義できます)。

paper-size は用紙サイズを定義します (A4 やレターなど)。

例:

$set remove(control)
working-storage section.
copy "cbltypes.cpy".
01 PRT-INFO-1 is typedef.
  03 pi-struct-size      cblt-os-size.
  03 hdc                 cblt-pointer.
  03 hps                 cblt-os-size.
  03 orientation         pic x(4) comp-5.
  03 rows                pic x(4) comp-5.
  03 cols                pic x(4) comp-5.
  03 rows-left           pic x(4) comp-5.
  03 max-horiz           pic x(4) comp-5.
  03 max-vert            pic x(4) comp-5.
 03 min-horiz           pic x(4) comp-5.
  03 min-vert            pic x(4) comp-5.
  03 curr-horiz          pic x(4) comp-5.
  03 curr-vert           pic x(4) comp-5.
  03 copies              pic 9(4) comp-5.
  03 quality             pic 9(4) comp-5.
  03 color               pic 99 comp-5.
  03 reserved1           pic x comp-5.
  03 driver-ver          pic 9(4) comp-5.
  03 pname.
    05 cbsize            cblt-os-size.
    05 buffer            pointer.
  03 ptype.
    05 cbsize            cblt-os-size.
    05 buffer            pointer.
  03 pdevice.
    05 cbsize            cblt-os-size.
    05 buffer            pointer.
  03 plocation.
    05 cbsize            cblt-os-size.
    05 buffer            pointer.
  03 pcomment.
    05 cbsize            cblt-os-size.
    05 buffer            pointer.
  03 ppapersize.
    05 cbsize            cblt-os-size.
    05 buffer            pointer.
01.
  03 document-title.
    05 title-len         pic x(2) comp-5.
    05 title-text        pic x(20).
      03  font-family.
    05 font-family-namelen  pic x(2) comp-5 value 80.
    05 font-family-name     pic x(80).
  03 print-info          PRT-INFO-1.
  03 abort               pic x(4) comp-5 value 1.
  03 control             pic x(4) comp-5 value 2.
  03 flags               pic x(4) comp-5 value 3.
  03 handle              pic x(4) comp-5.
01 cblt-pi-printer-name          pic x(255).
01 cblt-pi-printer-type          pic x(255).
01 cblt-pi-printer-device        pic x(255).
01 cblt-pi-printer-location      pic x(255).
01 cblt-pi-printer-comment       pic x(255).
01 cblt-pi-printer-papersize     pic x(255).

procedure division.
    move 17 to title-len
    move "Printer Info Test" to title-text

    call "PC_PRINTER_OPEN" using by reference handle
                                 by reference document-title
                                 by value flags
                                 by value 0
    end-call

    if return-code = zero
        move all x"0" to print-info
        move length of print-info to pi-struct-size
        set buffer of pname of print-info
            to address of cblt-pi-printer-name
        move 255 to cbsize of pname of print-info
        set buffer of ptype of print-info
            to address of cblt-pi-printer-type
        move 255 to cbsize of ptype of print-info
        set buffer of pdevice of print-info
             to address of cblt-pi-printer-device
        move 255 to cbsize of pdevice of print-info
        set buffer of plocation of print-info
            to address of cblt-pi-printer-location
        move 255 to cbsize of plocation of print-info
        set buffer of pcomment of print-info
            to address of cblt-pi-printer-comment
        move 255 to cbsize of pcomment of print-info
        set buffer of ppapersize of print-info
            to address of cblt-pi-printer-papersize
        move 255 to cbsize of ppapersize of print-info
        call "PC_PRINTER_INFO" using by reference handle
                                     by reference print-info
        end-call
        display return-code
        if return-code not equal zero
            display "PC_PRINTER_INFO failed (return-code)"
            display "   === " return-code
            perform close-down-printer
            stop run
        end-if
        display "Orientation   : " orientation of print-info
        display "Rows          : " rows of print-info
        display "Cols          : " cols of print-info
        display "Rows Left     : " rows-left of print-info
        display "Max horz      : " max-horiz of print-info
        display "Max vert      : " max-vert of print-info
        display "Min horz      : " min-horiz of print-info
        display "Min vert      : " min-vert of print-info
        display "Current horz  : " curr-horiz of print-info
        display "Current vert  : " min-vert of print-info
        display "Copies        : " copies of print-info
        display "Quality       : " no advancing
        evaluate quality of print-info
         when 0 display "Draft"
         when 1 display "Low"
         when 2 display "Medium"
         when 3 display "High"
         when 4 display "printers default used"
         when other display quality of print-info " DPI"
        end-evaluate
        display "Color         : " no advancing
        if color of print-info equals 0
            display "Mono Chrome"
        else
            display "Color"
        end-if
        if cbsize of pname of print-info equal 0
            display "Printer name  : not available"
        else
            display "Printer name  : "
                    cblt-pi-printer-name(1:
                         cbsize of pname of print-info)
           display "Printer name  size : "
                   cbsize of pname of print-info
        end-if
        if cbsize of ptype of print-info equal 0
           display "Printer type  : not available"
        else
            display "Printer type  : "
                    cblt-pi-printer-type(1:
                         cbsize of ptype of print-info)
            display "Printer type size : "
                    cbsize of ptype of print-info
        end-if
        if cbsize of pdevice of print-info equal 0
            display "Printer device: not available"
        else
            display "Printer device(s): "
                    cblt-pi-printer-device(1:
                         cbsize of pdevice of print-info)
            display "Printer device size : "
                    cbsize of pdevice of print-info
        end-if
        if cbsize of plocation of print-info equal 0
            display "Printer location: not available"
        else
            display "Printer location: "
                    cblt-pi-printer-location(1:
                         cbsize of plocation of print-info)
            display "Printer location size : "
                    cbsize of plocation of print-info
        end-if
        if cbsize of pcomment of print-info equal 0
            display "Printer comment: not available"
        else
            display "Printer comment: "
                    cblt-pi-printer-comment(1:
                         cbsize of pcomment of print-info)
            display "Printer comment size : "
                    cbsize of pcomment of print-info
        end-if
        if cbsize of ppapersize of print-info equal 0
            display "Printer papersize: not available"
        else
            display "Printer papersize: "
                    cblt-pi-printer-papersize(1:
                         cbsize of ppapersize of print-info)
            display "Printer papersize size : "
                    cbsize of ppapersize of print-info
        end-if
        display "Driver version : "driver-ver of print-info
    end-if
    perform close-down-printer
    .

close-down-printer section.
    call "PC_PRINTER_CONTROL" using by reference handle
                                    by value abort
    end-call

    call "PC_PRINTER_CLOSE" using by reference handle
    end-call
    .