Results 1 to 4 of 4

Thread: Change printer locally, not set as default Win

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2000
    Posts
    3
    I want an app to only change the printer default within the application. If I use the common dialog, I can set .defaultprinter=False to stop the Windows default printer from changing, but then my local printer isn't changed either!

    Code:

    Private Sub mnuFPrtSetup_Click()
    cmdlg.PrinterDefault = False
    cmdlg.Flags = cdlPDPrintSetup
    cmdlg.ShowPrinter ' display Printer Setup cdlg box.
    VPrint.DeviceName = Printer.DeviceName

    End Sub

    What can I do to change printers and not change windows defaults?

  2. #2
    Member
    Join Date
    May 2000
    Location
    Canada
    Posts
    52
    I think all that you can do is to get the default printer in a variable, select the printer with the commondialog control (which then set the default to the printer that you have selected) and set the default printer back to the printer in the variable when you are done.

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2000
    Posts
    3
    I guess I need more help. If I change the printer within the app, I don't want the user to have to change it each time the app is opened, and I also don't want it to change the Windows default printer. What are some standard ways of persistence, either in the registry or in a database? Does anyone have working examples of this? I apologize for my lameness, but everything I have tried ultimately changes the windows default, which is unacceptable.

  4. #4
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    No problemo!

    Code:
    Private sDefaultPrinter$
    Private Sub Form_Load()
    sDefaultPrinter = GetSetting (app.Title, "Options", "DefaultPrinter")
    if sDefaultPrinter = "" Then
    
    cmdlg.PrinterDefault = False 
    cmdlg.Flags = cdlPDPrintSetup 
    cmdlg.ShowPrinter ' display Printer Setup cdlg box. 
    VPrint.DeviceName = Printer.DeviceName 
    sDefaultPrinter = VPrint.DeviceName
    End Sub
    
    Private Sub Form_Unload(Cancel As Integer)
    SaveSetting app.Title, "Options", "DefaultPrinter", sDefaultPrinter
    End Sub

    Hope you can work it out
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width