Click here to Skip to main content
16,011,436 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Toolbar tooltip question Pin
Stevenpph7-Nov-02 10:06
Stevenpph7-Nov-02 10:06 
GeneralRe: Toolbar tooltip question Pin
Joaquín M López Muñoz7-Nov-02 10:11
Joaquín M López Muñoz7-Nov-02 10:11 
GeneralDynamic Prop. Sheet Pin
john john mackey7-Nov-02 8:31
john john mackey7-Nov-02 8:31 
GeneralRe: Dynamic Prop. Sheet Pin
Joaquín M López Muñoz7-Nov-02 8:44
Joaquín M López Muñoz7-Nov-02 8:44 
GeneralRe: Dynamic Prop. Sheet Pin
Joan M7-Nov-02 8:52
professionalJoan M7-Nov-02 8:52 
GeneralLock xadd Pin
José Luis Sogorb7-Nov-02 6:57
José Luis Sogorb7-Nov-02 6:57 
GeneralRe: Lock xadd Pin
Daniel Turini7-Nov-02 7:07
Daniel Turini7-Nov-02 7:07 
QuestionCRichEditCtrl printng... What's wrong with my code? Pin
Nasty_p7-Nov-02 5:04
Nasty_p7-Nov-02 5:04 
void CIa_notesDlg::PrintNotes()
CPrintDialog dlg(FALSE);
if (dlg.DoModal() != IDOK)
return;
HDC hPrinterDC = dlg.GetPrinterDC();
if (hPrinterDC == NULL)
AfxMessageBox("Printer not found"/*IDS_SCRIPT_PRINTER_NOT_FOUND*/,MB_OK|MB_ICONSTOP);
else
{
FORMATRANGE fr;
int nHorizRes = GetDeviceCaps(hPrinterDC, HORZRES);
int nVertRes = GetDeviceCaps(hPrinterDC, VERTRES);
int nLogPixelsX = GetDeviceCaps(hPrinterDC, LOGPIXELSX);
int nLogPixelsY = GetDeviceCaps(hPrinterDC, LOGPIXELSY);
LONG lTextLength; // Length of document.
LONG lTextPrinted; // Amount of document printed.

// Ensure the printer DC is in MM_TEXT mode.
SetMapMode ( hPrinterDC, MM_TEXT );

// Rendering to the same DC we are measuring.
ZeroMemory(&fr, sizeof(fr));
fr.hdc = fr.hdcTarget = hPrinterDC;

// Set up the page.
fr.rcPage.left = fr.rcPage.top = 0;
fr.rcPage.right = (nHorizRes/nLogPixelsX) * 1440;
fr.rcPage.bottom = (nVertRes/nLogPixelsY) * 1440;

// Set up 1" margins all around.
fr.rc.left = fr.rcPage.left + 1440; // 1440 TWIPS = 1 inch.
fr.rc.top = fr.rcPage.top + 1440;
fr.rc.right = fr.rcPage.right - 1440;
fr.rc.bottom = fr.rcPage.bottom - 1440;

// Default the range of text to print as the entire document.
fr.chrg.cpMin = 0;
fr.chrg.cpMax = -1;

DOCINFO di;
ZeroMemory(&di, sizeof(di));
di.cbSize = sizeof(DOCINFO);
di.lpszDocName = _T("(Notes)");
di.lpszOutput = NULL; // Do not print to file.

StartDoc(hPrinterDC, &di); // Start the document.
lTextLength = m_notesExistantes.GetTextLength();
do {
StartPage(hPrinterDC); // Start the page.
// Print as much text as can fit on a page. The return value is
// the index of the first character on the next page. Using TRUE
// for the wParam parameter causes the text to be printed.
#ifdef USE_BANDING
lTextPrinted=m_notesExistantes.FormatRange(&fr,FALSE);
m_notesExistantes.DisplayBand(&fr.rc);
#else
lTextPrinted=m_notesExistantes.FormatRange(&fr,TRUE);
#endif
EndPage(hPrinterDC); // Print last page.
// If there is more text to print, adjust the range of characters
// to start printing at the first character of the next page.
if (lTextPrinted < lTextLength)
{
fr.chrg.cpMin = lTextPrinted;
fr.chrg.cpMax = -1;
}
} while (lTextPrinted < lTextLength);
// Tell the control to release cached information.
m_notesExistantes.FormatRange(NULL,0);
EndDoc (hPrinterDC);
}

-------------
-= Nasty_p =-
AnswerRe: CRichEditCtrl printng... What's wrong with my code? Pin
dabs7-Nov-02 5:38
dabs7-Nov-02 5:38 
GeneralRe: CRichEditCtrl printng... What's wrong with my code? Pin
Nasty_p7-Nov-02 5:44
Nasty_p7-Nov-02 5:44 
GeneralRe: CRichEditCtrl printng... What's wrong with my code? Pin
Nasty_p12-Nov-02 14:20
Nasty_p12-Nov-02 14:20 
GeneralNeed example of forward declare Pin
bhutt7-Nov-02 5:09
bhutt7-Nov-02 5:09 
GeneralRe: Need example of forward declare Pin
Marc Clifton7-Nov-02 5:42
mvaMarc Clifton7-Nov-02 5:42 
GeneralRe: Need example of forward declare Pin
Anonymous8-Nov-02 2:24
Anonymous8-Nov-02 2:24 
GeneralRe: Need example of forward declare Pin
dabs7-Nov-02 5:57
dabs7-Nov-02 5:57 
GeneralStyle fro CHeaderCtrl Pin
Telefonen7-Nov-02 5:01
Telefonen7-Nov-02 5:01 
GeneralRe: Style fro CHeaderCtrl Pin
Daniel Ferguson7-Nov-02 6:47
Daniel Ferguson7-Nov-02 6:47 
GeneralResizing the desktop area Pin
MiamiCoder7-Nov-02 4:46
MiamiCoder7-Nov-02 4:46 
GeneralRe: Resizing the desktop area Pin
Chris Richardson7-Nov-02 7:08
Chris Richardson7-Nov-02 7:08 
GeneralRe: Resizing the desktop area Pin
Anonymous7-Nov-02 10:20
Anonymous7-Nov-02 10:20 
Generaldll Pin
7-Nov-02 3:59
suss7-Nov-02 3:59 
GeneralRe: dll Pin
Anonymous7-Nov-02 4:38
Anonymous7-Nov-02 4:38 
GeneralRe: dll Pin
Stephane Rodriguez.7-Nov-02 4:57
Stephane Rodriguez.7-Nov-02 4:57 
Generalget default printer name Pin
vgkotha7-Nov-02 3:25
vgkotha7-Nov-02 3:25 
GeneralRe: get default printer name Pin
Navin7-Nov-02 3:51
Navin7-Nov-02 3:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.