Quantcast
Channel: Visual COBOL - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 4356

RE: Default printer

$
0
0

Hi,

You could use the MS API GetDefaultPrinter ( msdn.microsoft.com/.../dd144876.aspx) .

COBOL code snippet

...

      special-names.

          call-convention 74 is stdcall.

...

WSS:

      78 LENGTH-pszBuffer value 100.

      01 pszBuffer         pic x(LENGTH-pszBuffer).

      01 pcchBuffer       DWORD value LENGTH-pszBuffer.

      01 b pic 9(9) comp-5. *>bool.

...

PROCEDURE DIVISION.

...

          call STDCALL "GetDefaultPrinterA"

              using by reference pszBuffer

                    by reference pcchBuffer

              returning b

          if b = 0   display "*--> Pb in GetDefaultPrinter"

                     stop run

          end-if

...

When linking, link with MS lib  Winspool.lib ... delivered by MS.

Regards

Yvon


Viewing all articles
Browse latest Browse all 4356

Trending Articles