Problem:
This program demonstrates how to use the Windows 32-bit API function EnumPrinters to obtain a list of available printers and their associated parameters. This demo works on Windows 95, 98 NT, 2000 and XP
Resolution:
INTRODUCTION
==========
This program demonstrates how to use the Windows 32-bit API
function EnumPrinters to obtain a list of available printers
and their associated parameters.
SOURCE FILES:
=============
Program Files Description
------------------------- -----------------------------------------------------------
ENUMPRNT.CBL Main program for this demo
EnumprintLocal.CBL Program that calls the WINAPI function EnumPrinters to list
local/network printers for 95/98/ME and local printers for NT/2000/XP
EnumprintNetwork.cbl Program that calls the WINAPI function EnumPrinters to list network
printers for NT/2000/XP
InfoOS.CBL Program that calls WINAPI function GetVersion to determine if OS
is NT/2000/XP
WINSPOOL.LIB
Import library from the Windows SDK. This file is linked into
ENUMPRNT.EXE to resolve the reference to EnumPrintA. This is provided
with the Windows SDK. See requirements.
REQUIREMENTS:
==========
This sample should run in all environments. At least one printer should be attached to or be accessible from the system on which this program is run.
In order to link this program you need to install the Microsoft Windows 32-bit SDK. This CD-ROM is supplied with Net Express. The installation should create a directory MSTOOLS\\LIB directory. Modify the Build Settings for EnumPrnt.EXE under Link/Advanced and change the location of WINSPOOL.LIB to point to the directory containing this file on your system.
OPERATION:
========
Rebuild this project to create the file EnumPrnt.exe. This is a character mode program that will display the name of all local and network printers attached to your computer.
REFERENCE:
========
call-convention
---------------
NetExpress Bookshelf: Language Reference, Part 2:
Compilation Group Definition,
Chapter 6: Environment Division,
Section 6.1.2.3
The Special-names Paragraph
Netxpress Help: Click Find tab, type "call-convention" in
window 1, click "call-convention" in window
2, click "Call conventions for interfacing
with mixed language applications",
click Display button.
COBOL Call Prototypes
---------------------
NetExpress Bookshelf: Language Reference, Part 1 COBOL
Concepts, Chapter 3 Language
Fundamentals, Section 3.4 Call
Prototypes.
NetExpress Bookshelf: Language Reference - Additional
Topics, Chapter 6: Examples, 6.1 Call
Prototypes.
Compiler Constant Directive
---------------------------
NetExpress Help: Click Index tab, type "constant" in window
1, click "CONSTANT Compiler directive" in
window 2 and click the Display button.
Conditional Compilation
-----------------------
NetExpress Bookshelf: Language Reference, Part 2:
Compilation Group Definition, Chapter
18: Compiler-directing Statements,
Section 18.5 Conditional Compilation,
18.5.2 $ELSE Statement, 18.5.3 $END
Statement, 18.5.4 $IF Statement.
EnumPrinters
------------
Win32 SDK Help: Open Win32 Programmer's Reference, open
Reference, open Functions,open EnumObjectProc
to FillCOnsoleOutputCharacter, double click
EnumPrinters, click and read Quick Info
button information noting import library
name (Dll name is usually the same),
Unicode specification and Header file
name, read document.
MSDN Web Site:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/prntspol_9fjn.asp
GetVersionEx
------------
Win32 SDK Help: Open Win32 Programmer's Reference, open
Reference, open Functions,open GetUpdateRect
to HeapReAlloc, double click GetVersionEx,
click and read Quick Info button information
noting import library name (Dll name is
usually the same), Unicode specification
and Header file name, read document.
MSDN Web Site:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/sysinfo_49iw.asp
NOTE:
====
The file WINSPOOL.LIB is specified under Project/Build Settings/Link/Advanced in the Link with these LIB's field. It must be included in any program that makes a call to EnumPrintersA.
==========================================================
Keywords: demonstration, sample, example, demo, printing, enumPrnt.zip
demo.ex
demo.me
demo.ne