Solved

Printing using the default printer from within a function

Posted on 1998-07-15
4
186 Views
Last Modified: 2013-11-20
How do I call the default printing in a View from other than the menu?  I would also like to suppress the Print Dialog.  I have a POS application (MDI) in progress with buttons in the main view class indicating payment methods.  When the user presses the appropriate button, I would like to do some calcs, open the cash drawer, then print the invoice without further users intervention.  I have the default printing in the view class implemented and working from the menu and toolbar.

Thanks,

Pat...
0
Comment
Question by:patrickm
[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
4 Comments
 
LVL 1

Expert Comment

by:TAMC
ID: 1319249
I have done something similar, what you do, I don't know the exact code off hand but can get it if you can't figure it out, is Post a Messeage to your application the windows message you post is something like ID_FILE_PRINT_DIRECT, I think, if you look at the menu handler for the toolbar option print, it will tell you, since that suppresses the dialog, not showing it, which is what I think you want.  comment if you have any further questions.
0
 

Author Comment

by:patrickm
ID: 1319250
Thanks TAMC, I am very weak on MFC and VC++, if you could provide me with syntax, I would appreciate it.

Pat...

0
 
LVL 23

Accepted Solution

by:
chensu earned 50 total points
ID: 1319251
There are several methods. One of them is the following.

CDC PrnDC;
PRINTDLG PrintDlg;
BOOL bSucc = ::AfxGetApp()->GetPrinterDeviceDefaults(&PrintDlg) &&
             ::AfxGetApp()->CreatePrinterDC(PrnDC);
if (bSucc)
{
    // use PrnDC to print
}
else
{
    // failed to create the printer DC
}

0
 

Author Comment

by:patrickm
ID: 1319252
I ended up with

OnFilePrint();

in my View Class. Works like a charm.

Thanks for the syntax chensu
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

Suggested Solutions

Title # Comments Views Activity
Include multiple hostnames in this command? 3 56
matchUp  challenge 9 134
Sed question 2 139
Change to event 1 138
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

739 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