` Enumerating printers (Ralf Schoeffler ) - Icetips Article
Icetips - Templates, Tools & Utilities for Clarion Developers

Templates, Tools and Utilities
for Clarion Developers

Icetips Article

Back to search     Printer friendly     Add Comment     Direct link  

Par2: Enumerating printers
1999-11-03 -- Ralf Schoeffler
 
Here is a procedure that store the printers in a queue. Best Regards Ralf Schoeffler !----------------------------- snipp --------------------------------------------------------- ! inside the global map MODULE('WINAPI') EnumPrintersA(ULONG,*CSTRING,ULONG,*BYTE,ULONG,*ULONG,*ULONG),BOOL,PASCAL,RA W END !DATA flag ULONG pname CSTRING(255) level ULONG cbBuf ULONG cbBuffer STRING(65536) pcbNeed ULONG pcRetrun ULONG pPrinterEnum BYTE OVER(cbBuffer) ret LONG zeiger LONG,DIM(16384) OVER(cbBuffer) tstr STRING(250) tbyte BYTE pPrinter Queue Name STRING(32) Port STRING(60) SPrinter BYTE END !CODE flag = 2 ! PRINTER_ENUM_LOCAL pname = '' ! Cstring(255) level = 2 ! Printer_Info_2 cbBuf = 65536 ! Size of cbpBuffer pcbNeed = 0 ! Struktur in Bytes pcRetrun = 0 ! Anzahl der Drucker ret = EnumPrintersA(flag,pname,level,pPrinterEnum,cbBuf,pcbNeed,pcRetrun) loop p# = 0 to pcRetrun - 1 clear(pPrinter) !--------------------------------------------------------------------------- ---------------- ! printername !--------------------------------------------------------------------------- ---------------- tstr = '' loop i# = 0 to 32 peek(zeiger[2+(p#*21)]+i#, tbyte) if tbyte = 0 then break end tstr[i#+1] = chr(tbyte) end pPrinter:Name = tstr !--------------------------------------------------------------------------- ---------------- ! Standard Printer !--------------------------------------------------------------------------- ---------------- if clip(pPrinter:Name) = clip(PRINTER{PROPPRINT:Device}) then pPrinter:SPrinter = 1 end !--------------------------------------------------------------------------- ---------------- ! Printerport !--------------------------------------------------------------------------- ---------------- tstr = '' loop i#=0 to 32 peek(zeiger[4+(p#*21)]+i#,tbyte) if tbyte=0 then break end tstr[i#+1]=chr(tbyte) end pPrinter:Port = tstr pPrinters = pPrinter add(pPrinters) end !loop !----------------------------- snipp ---------------------------------------------------------


Today is May 13, 2025, 4:08 am
This article has been viewed 35381 times.


Back to search     Printer friendly     Add Comment

Login

User Name:

Password: