Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 5th, 2004, 10:44 PM
Registered User
Join Date: Feb 2004
Location: , , .
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.
Reply With Quote
  #2 (permalink)  
Old April 7th, 2004, 06:59 PM
Registered User
Join Date: Apr 2004
Location: Mexico City, D.F., Mexico.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts

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

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 10:14 AM.

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