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

x
?
Solved

MFC Printing Woes

Posted on 1998-10-31
4
Medium Priority
?
252 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
[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 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 200 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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

722 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