Solved

MFC Printing Woes

Posted on 1998-10-31
4
245 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Could you possibly provide a code snippet?

Pat..
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

771 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

10 Experts available now in Live!

Get 1:1 Help Now