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



The information in this article applies to:

  • Microsoft Visual FoxPro for Windows 5.0
  • Microsoft Visual FoxPro for Windows 5.0a
  • Microsoft Visual FoxPro for Windows 6.0
  • Microsoft Visual FoxPro for Windows 7.0
  • Microsoft Visual FoxPro 8.0
  • 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.

MORE INFORMATION

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()
  3. Expand the drop-down list and note the values that appear next to the Name, Type, and Where labels in the dialog box.
  4. Perform the steps above on a Windows 95 or 98 machine.
  5. 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.

REFERENCES

For additional information about APRINTERS, please see the following article in the Microsoft Knowledge Base:

Q155929 BUG: APRINTERS Function Behaves Differently in Windows 95

For more information about the APRINTERS function, search for APRINTERS, and then in Visual FoxPro Help.

Modification Type:MajorLast Reviewed:2/18/2005
Keywords:kbpending kbprb kbXBase KB220157