FIX: Printer Object Fails to Track Default Printer After Orientation Is Changed (257688)
The information in this article applies to:
- Microsoft Visual Basic Professional Edition for Windows 6.0
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
This article was previously published under Q257688 SYMPTOMS
When you try to select a printer in the Printer dialog box and then change a property of the Printer object, such as orientation, the Printer object does not retain the selected default printer setting.
RESOLUTION
You can work around this problem by following either one of the two methods outlined here: Workaround #1 (for Windows 95, Windows 98, and Windows Me systems only)
Use the GetProfileString function to obtain the default printer information.
On Windows 9x and Windows Me systems, the default printer setting is stored in the Registry and in the [Windows] section of the win.ini file in the windows folder. The code line starting with "Device=" shows information about the default printer. The [Devices] section has information about all installed printers in the system.
On Microsoft Windows NT and Microsoft Windows 2000, this information is stored in the Registry. The GetPrifileString function retrieves the default printer information on any of these systems because the win.ini file entries are remapped to the Registry. However, selecting a printer from the Common dialog box under Windows NT and Windows 2000 does not make it the default printer. See the "References" section of this article for more information. Workaround #2
Set Printer.TrackDefault=True after changing the printer in the Printer dialog box as follows:
Private Sub Command1_Click()
CommonDialog1.ShowPrinter
Printer.TrackDefault=True
MsgBox Printer.DeviceName
End Sub
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. This bug was corrected in the latest service pack for Visual Studio 6.0. Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. This bug was corrected in the latest service pack for Visual Studio 6.0. For additional information about Visual Studio service packs, click the following article numbers to view the articles in the Microsoft Knowledge Base: 194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why
194295 HOWTO: Tell That a Visual Studio Service Pack Is Installed To download the latest Visual Studio service pack, visit the following Microsoft Web site: REFERENCESFor additional information, click the article number below
to view the article in the Microsoft Knowledge Base:
198712 PRB: CommonDialog Changes System Wide Printer Properties
Modification Type: | Minor | Last Reviewed: | 12/12/2005 |
---|
Keywords: | kbAPI kbBug kbCmnDlgPrint kbfix kbprint KB257688 |
---|
|