PC_PRINTER_INFO

固有のデバイスコンテキスト操作および固有のグラフィック機能を直接呼び出すことにより、文書の印刷機能を高めるために使用されるその他の情報を返す。

構文:
call "PC_PRINTER_INFO using     cblt-pi-printer-handle
                                cblt-pi-printer-info-struct
                      returning status-code
パラメタ:
呼び出しプロトタイプ使用時 (  説明の読み方) PIC (32ビットシステム)
printer-handle cblt-x4-comp5 pic x(4) comp-5.
print-info-struct 以下を含む集団項目: 以下を含む集団項目:
  cblt-pi-struct-size   cblt-os-size   pic x(4) comp-5.
  cblt-pi-printer-hdc   cblt-pointer   pointer.
  cblt-pi-printer-hps   cblt-os-size   pic x(4) comp-5.
  cblt-pi-printer-orientation   cblt-x4-comp5   pic x(4) comp-5.
  cblt-pi-printer-rows   cblt-x4-comp5   pic x(4) comp-5.
  cblt-pi-printer-cols   cblt-x4-comp5   pic x(4) comp-5.
  cblt-pi-printer-rows-left   cblt-x4-comp5   pic x(4) comp-5.
  cblt-pi-printer-max-horiz   cblt-x4-comp5   pic x(4) comp-5.
  cblt-pi-printer-max-vert   cblt-x4-comp5   pic x(4) comp-5.
  cblt-pi-printer-min-horiz   cblt-x4-comp5   pic x(4) comp-5.
  cblt-pi-printer-min-vert   cblt-x4-comp5   pic x(4) comp-5.
  cblt-pi-printer-curr-horiz   cblt-x4-comp5   pic x(4) comp-5.
  cblt-pi-printer-curr-vert   cblt-x4-comp5   pic x(4) comp-5.
  cblt-pi-printer-copies   cblt-x2-comp5   pic 9(4) comp-5.
  cblt-pi-printer-quality   cblt-x2-comp5   pic 9(4) comp-5.
  cblt-pi-printer-color   cblt-x1-comp5   pic 99 comp-5.
  cblt-pi-reserved-item1   cblt-x1-comp5   pic 99 comp-5.
  cblt-pi-printer-device-ver   cblt-x2-comp5   pic 9(4) comp-5.
  cblt-pi-printer-name   以下を含む集団項目:   以下を含む集団項目:
    cblt-pi-printer-pname-size     cblt-os-size     pic x(4) comp-5.
    cblt-pi-printer-pname     cblt-pointer     pointer.
  cblt-pi-printer-type   以下を含む集団項目:   以下を含む集団項目:
    cblt-pi-printer-ptype-size     cblt-os-size     pic x(4) comp-5.
    cblt-pi-printer-ptype     cblt-pointer     pointer.
  cblt-pi-printer-device   以下を含む集団項目:   以下を含む集団項目:
    cblt-pi-printer-pdevice-size     cblt-os-size     pic x(4) comp-5.
    cblt-pi-printer-pdevice     cblt-pointer     pointer.
  cblt-pi-printer-location   以下を含む集団項目:   以下を含む集団項目:
    cblt-pi-printer-plocation-size     cblt-os-size     pic x(4) comp-5.
    cblt-pi-printer-plocation     cblt-pointer     pointer.
  p-comment   以下を含む集団項目:   以下を含む集団項目:
    cblt-pi-printer-pcomment-size     cblt-os-size     pic x(4) comp-5.
    cblt-pi-printer-pcomment     cblt-pointer     pointer.
  cblt-pi-printer-type   以下を含む集団項目:   以下を含む集団項目:
    cblt-pi-printer-papersize-size     cblt-os-size     pic x(4) comp-5.
    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-rows 現行のフォント使用時のページあたりの総行数
cblt-pi-printer-cols 現行のフォント使用時のページあたりの総列数
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、キヤノンなど)

cblt-pi-printer-deviceはプリンタデバイスを指定する。たとえば、 lpt1::file、:com1など。本パラメタは複数のデバイスで設定できる。各デバイスはコンマで分ける。( lpt1:,lpt2:など)

cblt-pi-printer-commentはプリンタに関するコメントを指定する。("Printer for accounts"など)

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

例:
$set remove(control)
 working-storage section.
 01 PRT-INFO-1 is typedef.
   03 pi-struct-size      pic x(4) comp-5.
   03 hdc                 pic x(4) comp-5.
   03 hps                 pic x(4) comp-5.
   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            pic x(4) comp-5.
     05 buffer            pointer.
   03 ptype.
     05 cbsize            pic x(4) comp-5.
     05 buffer            pointer.
   03 pdevice.
     05 cbsize            pic x(4) comp-5.
     05 buffer            pointer.
   03 plocation.
     05 cbsize            pic x(4) comp-5.
     05 buffer            pointer.
   03 pcomment.
     05 cbsize            pic x(4) comp-5.
     05 buffer            pointer.
   03 ppapersize.
     05 cbsize            pic x(4) comp-5.
     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 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
         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
     .