Solved

How do you print to non-default printer

Posted on 1998-10-08
2
191 Views
Last Modified: 2010-04-30
I would like to print but do so using a non-default printer.  I don't want to bring up the common dialog box on this one.  I want the user to be able to pick from a list of printers, the list of which is filled by parsing through the printers collection and filling the cmbo box with the devicenames of those printers.  Typically, if you use the printer object, then that object only uses the default printer.  But I know there's a way to use the hdc to print to a non-default printer without making that non-default printer default.  The hdc method is what I think I want to do.  But I don't know how to use it.  How can I print using a non-default printer without making it default and by using the hdc methods.  Thanks!
0
Comment
Question by:ksm
2 Comments
 
LVL 2

Expert Comment

by:shchuka
Comment Utility
hdc methods you are mentioning are API methods.  Once you've obtained the hdc of the printer (device context), you can print to that hdc using API calls, such as
DrawText(), Rectangle(), Ellipse(), etc.

Note that in this case you will need to do your own print job management, i.e. output spool information, paginate output, etc.

Start looking at the StartDoc() API and go from there.

-Aleks.
0
 
LVL 14

Accepted Solution

by:
waty earned 50 total points
Comment Utility
Set the printer object to the desired printer (setting as default), then once the print is done, set back to the previous default printer
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now