PC_PRINTER_ENUM_START

Starts the process of enumerating printers.
Restriction: This routine is not currently supported on UNIX platforms.

Syntax:

call "PC_PRINTER_ENUM_START" using by reference enum-handle
                                   by value enum-flags
                                   by reference number-of-printers-found

Parameters

enum-handle
Call prototype (see Key): cblt-pointer
Picture: pointer.
enum-flags
Call prototype (see Key): cblt_os_flags
Picture: pic x(4) comp-5 or pic x(8) comp-5 (64-bit native only).
number-of-printers-found
Call prototype (see Key): cblt_os_size
Picture: pic x(4) comp-5 or pic x(8) comp-5 (64-bit native only).

On Entry:

enum-handle
Not set.
enum-flags
Flags controlling the behavior of the call. Must be set to 0.
number-of-printers-found
Not set.

On Exit:

enum-handle
Valid enumeration handle if number of printers > 0
number-of-printers-found
Number of printers found
return-value
One of:
0
Enumeration started
!= 0
PC_PRINTER error code

Example

01 enum-handle           pointer.
01 printer-name.
   03 p-name-len           pic x(2) comp-5. 
   03 p-name               pic x(255).
01 enum-flags              pic x(4) comp-5 value 0.
01 enum-printers-found     pic x(4) comp-5 value 0.
01 p-counter      binary-long.

procedure division.
  move 1 to p-counter
  set p-name-len to length of p-name
  call "PC_PRINTER_ENUM_START" using
          by reference enum-handle
          by value enum-flags
          by reference enum-printers-found
  end-call
  if return-code not equal 0
       display "RC: Enum-Start : " return-code
  end-if
  display "Printers found : " enum-printers-found
  perform until return-code not equal 0
       set p-name-len to length of p-name
       call "PC_PRINTER_ENUM_NEXT" using
              by value enum-handle
              by reference printer-name
       end-call
       if return-code not equal 0
              display "RC: Enum-Next : " return-code
       else
              display p-counter " " p-name(1:p-name-len)
                   " size " p-name-len
       end-if
       add 1 to p-counter
  end-perform

  call "PC_PRINTER_ENUM_CLOSE" using
                  by reference enum-handle
  end-call