Solved

MFC Printing Woes

Posted on 1998-10-31
4
247 Views
Last Modified: 2013-11-20
The following code works in my development enviroment, but not on the client's machine (same basic enviroment with 64mb instead of 128mb).  The problem is the 1st call to "OnFilePrint()" does not work, but the 2nd call to "OnFilePrint()" after the MessageBox() seems to work ok.

            // Print 1st Receipt, then 2nd Receipt
            OnFilePrint();
            MessageBox("Remove Receipt for Customer's Signature","Signature Copy",MB_OK);
            OnFilePrint();
            // Add Invoice to Database    /////// DB Write here  ///////
            AddRecord();
            // Create New Invoice
            GetDocument()->OnCloseDocument();
            CPosApp* pApp = (CPosApp*) AfxGetApp( );
            CDocument* pDoc = pApp->pDocTemplate->OpenDocumentFile(NULL);

Also, I would be happy to increase the points if any one can give me specific code samples to speed up the printing function (currently using MFC Doc/View std). Do I need to handling banding?  How?

Thanks

Pat...
0
Comment
Question by:patrickm
  • 2
4 Comments
 
LVL 2

Expert Comment

by:jstolan
ID: 1324093
Can you define "not working"?  Doesn't do anything?  Prints badly?  Also if you could define printing faster.  The paper comes out faster, or the job is sent to the spooler faster?  No, you no longer need to handle banding, the spooler should do it for you.
0
 

Author Comment

by:patrickm
ID: 1324094
The first call to OnFilePrint() doesn't do anything, it appears to just return with no output to the device.

Print faster meaning the paper comes out faster.  This is an Epson 40col receipt printer.  If I use the Mfr's driver, the output uses True Type Fonts, but is very slow.  If I use Generic/Text driver, the output speed is acceptable, but no fonts.

Thanks for your help.

Pat...

0
 
LVL 10

Accepted Solution

by:
RONSLOW earned 100 total points
ID: 1324095
Don't call OnFilePrint directly.

Use SendMessage or PostMessage with WM_COMMAND,ID_FILE_PRINT args.

Also probably best to use custom messages (registered messages best) to split your processing into two stages, so do a SendMessage to start your first printing, then do a PostMessage with a user-defined message;  In the handler for that message do the next part of the processing and then call SendMessage to do your next print etc.  That way, MFC/Windows gets a chance to do its message handling.

0
 

Author Comment

by:patrickm
ID: 1324096
Could you possibly provide a code snippet?

Pat..
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Show shut-down message as Windows 8 shuts down. 9 90
repeatEnd java challenge 42 84
Generic progress indicator 6 115
fix34  challenge 9 116
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
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…
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.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

813 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

15 Experts available now in Live!

Get 1:1 Help Now