Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
|
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 5th, 2004, 10:44 PM
Registered User
 
Join Date: Feb 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to save & restore default printer settings?

Hi. I have a VB6 application that changes the default printer. Before the default printer is changed, I'd like to save the original default printer settings. Then after the application is done running I want to restore the original default printer settings back. How can I do this?

Thank you.
Tiffany
 
Old April 7th, 2004, 06:59 PM
Registered User
 
Join Date: Apr 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It all depends on which settings you're changing and if you're using the Printer object to do so, you could probably save the original settings in variables and then restore them before you unload your app. If you are changing the default printer, then you can probably save the name in a variable and then, before unloading, iterate throught the Printers collection and set the Printer object to the one that matches the original Printer object's name.
I think something like this may do the trick for you:
'To save the original default printer's name
Public P As String
P = Printer.DeviceName

'Then before you unload, to reset the default printer
Dim Prt As Printer
For Each Prt In Printers
   If Prt.DeviceName = P Then
      'Set the printer object (which represents _
      'the default printer) to Prt
   End If
Next Prt







Similar Threads
Thread Thread Starter Forum Replies Last Post
Printer settings rajanikrishna Classic ASP Professional 8 April 7th, 2006 03:48 AM
printer settings at client side ramesh.b ASP.NET 2.0 Professional 0 March 7th, 2006 09:00 AM
Programmatically Change Printer Settings vempativenu Beginning VB 6 0 September 2nd, 2004 06:29 AM
Printer Settings melvik C# 0 May 25th, 2004 02:11 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.