Solved

select printer

Posted on 1998-08-19
12
213 Views
Last Modified: 2013-11-20
In my program I want to use a certain printer and the user should not be able to select one in the dialog. I want to do this in the sourcecode. I know how to disable the dialog but how about the printer selection ?
0
Comment
Question by:MarcoHelmers
12 Comments
 
LVL 23

Expert Comment

by:chensu
ID: 1320982
How To Get and Set the Default Printer in Windows
http://support.microsoft.com/support/kb/articles/q135/3/87.asp

How to Set the Default Printer Programmatically in Windows 95
http://support.microsoft.com/support/kb/articles/q140/5/60.asp
0
 

Author Comment

by:MarcoHelmers
ID: 1320983
Both pages you mentioned only refer to setting the default printer. What I actually want to do is to set the printer only for the document my program prints just as if you would do it in the printing dialog. How can I do that ?
0
 

Author Comment

by:MarcoHelmers
ID: 1320984
If you do not know please tell me ...
0
 
LVL 23

Expert Comment

by:chensu
ID: 1320985
Sorry. Look into the Win32 sample "Printer: Printing". It does what you want.
0
 

Author Comment

by:MarcoHelmers
ID: 1320986
Can anyone else tell me how it has to be done.
0
 

Expert Comment

by:bwilkins081898
ID: 1320987
I am familiar with windows printing functions.  Question...
Does you program know what the windows name is for the printer
you are trying to print to?

0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

Author Comment

by:MarcoHelmers
ID: 1320988
Yes, I do know the windows name for the printer. Do you know what I have to do ?
0
 

Author Comment

by:MarcoHelmers
ID: 1320989
Please help ...
0
 
LVL 23

Expert Comment

by:chensu
ID: 1320990
Look into the Win32 sample "Printer: Printing".
0
 

Author Comment

by:MarcoHelmers
ID: 1320991
that answer does not content me but ok ...
if you want the points ... lock the question...
0
 
LVL 23

Expert Comment

by:chensu
ID: 1320992
You may wait for a while to see whether there are better answers.
0
 
LVL 1

Accepted Solution

by:
Bonev earned 80 total points
ID: 1320993
here is a small function that retrieves a list of all installed printers:

void GetPrinterNameList(CStringArray& printerList)
{
      PRINTER_INFO_2* p;
      DWORD nbytes;
      DWORD nprinters;
      int i;

      EnumPrinters( PRINTER_ENUM_LOCAL, NULL, 2, NULL, 0, &nbytes, NULL);
      p = (PRINTER_INFO_2*)new char[nbytes];

      EnumPrinters( PRINTER_ENUM_LOCAL, NULL, 2, (unsigned char*)p, nbytes, &nbytes, &nprinters );

      printerList.RemoveAll();
      for( i = 0; i < nprinters; i++ )
            printerList.Add( p[i].pPrinterName );

      delete (char*)p;
}                                                                     


0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
iSeries DB2 Query 2 83
Shell script to login to remote m/c and execute commands 10 72
withoutTen challenge 14 88
firstChar challenge 13 83
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

708 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

16 Experts available now in Live!

Get 1:1 Help Now