Solved

MFC Printing Woes

Posted on 1998-10-31
4
248 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Installing Microsoft R server on REDHAT or SUSE Linux 4 147
iSeries DB2 Query 2 97
FizzBuzz challenge 9 82
Bartender label printing - switch on and off graphics 3 55
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…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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 an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

828 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