Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Local/Network printer test.

edited October 2009 in General
Hi,

RbPro 11.06, Delphi 2006, Vista SP2


In ppPrintr.pas procedure TppPrinterList.BuildPrinterList:

The test for local/network printers under win32 is not correct.

lbIsLocal := (lPrinterInfo4.Attributes <>
PRINTER_ATTRIBUTE_NETWORK);

it should be

lbIsLocal := (lPrinterInfo4.Attributes and
PRINTER_ATTRIBUTE_LOCAL) > 0;


I guess it's a documentation issue. The older Win SDK help from Delphi 2006
states that the attributes field can only be
PRINTER_ATTRIBUTE_LOCAL or PRINTER_ATTRIBUTE_NETWORK.

But the latest MSDN
(http://msdn.microsoft.com/en-us/library/dd162847(VS.85).aspx) says:
Attributes can also contain values that are defined in the Attributes
field of PRINTER_INFO_2.

A minor issue of course, IsLocal is only used to have different printer
icons in the printer setup dialog.


MSDN also states that PRINTER_INFO_4 needs at minimum Windows 2000, so if
somebody is still on NT4...


Regards,

Max Paay
Quadrant Software bv.
The Netherlands.




__________ Information from ESET NOD32 Antivirus, version of virus signature database 4514 (20091016) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

Comments

This discussion has been closed.