Login
`
Templates, Tools and Utilities
|
||
Add a comment to an Icetips ArticlePlease add your comments to this article.
Please note that you must provide both a name and a valid email address in order
for us to publish your comment. Comments are moderated and are not visible until they have been approved. Spam is never approved!
Back to article list Search Articles Add Comment Printer friendly 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 December 3, 2024, 12:05 pm This article has been viewed 35271 times.
|
|