Microsoft KB Archive/220157

= The GETPRINTERS function behaves differently based on the operating system in Visual FoxPro 5.0 and later versions =

Article ID: 220157

Article Last Modified on 2/12/2007

-

APPLIES TO


 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 5.0a
 * Microsoft Visual FoxPro 6.0 Professional Edition
 * Microsoft Visual FoxPro 7.0 Professional Edition
 * Microsoft Visual FoxPro 8.0 Professional Edition
 * Microsoft Visual FoxPro 9.0 Professional Edition

-



This article was previously published under Q220157



SYMPTOMS
In Microsoft Visual FoxPro 5.0 or later versions, the GETPRINTERS function produces both a different dialog and different results when querying printers from a computer that is running Microsoft Windows 95 or 98 as opposed to Windows NT 4.0, Windows 2000, Windows XP, or Windows Server 2003.



RESOLUTION
As a workaround, use the APRINTERS function to store the available printers into an array. Also, if you want to choose the printer when running a report, add the PROMPT clause to the REPORT FORM command.



Steps to reproduce the behavior

 * 1) Start Visual FoxPro 6.0 or 5.0 on a computer that is running Windows NT 4.0 or start Visual FoxPro 7.0 or later versions on a computer that is running Windows 2000, Windows XP, or Windows Server 2003.
 * 2) In the Command window, type:

? GETPRINTER
 * 1) Expand the drop-down list and note the values that appear next to the Name, Type, and Where labels in the dialog box.
 * 2) Perform the steps above on a Windows 95 or 98 machine.
 * 3) On the Windows NT, Windows 2000, Windows XP, or Windows Server 2003-based machine, the Name drop-down box contains the address of the printer if the printer is on a network. Therefore, the GETPRINTER function returns the printer's network address, if the printer is on a network. The Type label lists the actual printer name. If it is a local printer, they are the same. The Where label has a number and the word PASSTHRU.

On Windows 95 or 98, the Name drop-down box contains the name of the printer. Therefore, GETPRINTERS returns the name of the printer and not its network address under Windows 95 or 98. The Type label also has the name of the printer. The Where label has the network address. If the printer is local, Name and Type are the same.

