Solved

MFC Printing Woes

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
GIF file bit manipulation for color change 5 107
unable to delete all specified values regedit 38 283
fizzArray2 challenge 1 72
java ^ examples 8 62
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: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

867 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

22 Experts available now in Live!

Get 1:1 Help Now