Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How do you print to non-default printer

Posted on 1998-10-08
2
Medium Priority
?
228 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Expert Comment

by:shchuka
ID: 1438807
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 100 total points
ID: 1438808
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

705 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