Click here to Skip to main content
15,890,434 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionPRINTDLG to CPrintInfo Pin
_Flaviu21-Jul-14 23:43
_Flaviu21-Jul-14 23:43 
AnswerRe: PRINTDLG to CPrintInfo Pin
Richard MacCutchan22-Jul-14 0:29
mveRichard MacCutchan22-Jul-14 0:29 
GeneralRe: PRINTDLG to CPrintInfo Pin
_Flaviu22-Jul-14 1:22
_Flaviu22-Jul-14 1:22 
QuestionRe: PRINTDLG to CPrintInfo Pin
Richard MacCutchan22-Jul-14 2:19
mveRichard MacCutchan22-Jul-14 2:19 
AnswerRe: PRINTDLG to CPrintInfo Pin
_Flaviu22-Sep-14 1:25
_Flaviu22-Sep-14 1:25 
GeneralRe: PRINTDLG to CPrintInfo Pin
Richard MacCutchan22-Sep-14 1:29
mveRichard MacCutchan22-Sep-14 1:29 
GeneralRe: PRINTDLG to CPrintInfo Pin
_Flaviu22-Sep-14 1:39
_Flaviu22-Sep-14 1:39 
GeneralRe: PRINTDLG to CPrintInfo Pin
_Flaviu25-Sep-14 3:36
_Flaviu25-Sep-14 3:36 
Richard, I still have a question: I had tried to create manually an CPrintInfo object, just like that:
C++
CPrintDialog pdlg(FALSE);
pdlg.GetDefaults();
HDC hDC = pdlg.CreatePrinterDC();
if(NULL != hDC)
{
    m_pPreviewInfo = new CPrintInfo;
    m_dcPrint.CreateCompatibleDC(CDC::FromHandle(hDC));
    m_pPreviewInfo->m_rectDraw.left = 0;
    m_pPreviewInfo->m_rectDraw.top = 0;
    m_pPreviewInfo->m_rectDraw.right = m_dcPrint.GetDeviceCaps(HORZRES);
    m_pPreviewInfo->m_rectDraw.bottom = m_dcPrint.GetDeviceCaps(VERTRES);
    m_pPreviewInfo->m_bContinuePrinting = TRUE;
    m_pPreviewInfo->m_bDirect = TRUE;
    m_pPreviewInfo->m_bDocObject = FALSE;
    m_pPreviewInfo->m_bPreview = TRUE;
    m_pPreviewInfo->m_lpUserData = NULL;
    m_pPreviewInfo->m_pPD = &pdlg;
    m_pPreviewInfo->SetMinPage(1);
    m_pPreviewInfo->SetMaxPage(2);
    m_nPages = m_pPreviewInfo->m_nNumPreviewPages;
    m_pPreviewDC = new CPreviewDC;
    m_pPreviewDC->SetAttribDC(m_pPreviewInfo->m_pPD->m_pd.hDC);
    m_sizePrinterPPI.cx = m_dcPrint.GetDeviceCaps(LOGPIXELSX);
    m_sizePrinterPPI.cy = m_dcPrint.GetDeviceCaps(LOGPIXELSY);

    m_nPages = m_pPreviewInfo->m_nNumPreviewPages;
    if (m_nPages == 0)
        m_nPages = 1;
    else if (m_nPages > m_nMaxPages)
        m_nPages = m_nMaxPages;     // Sanity Check!
}

where m_pPreviewInfo and m_pPreviewDC is protected members of CMyCustomPrintPreview:
C++
CPreviewDC* m_pPreviewDC;
CPrintInfo* m_pPreviewInfo;

of the first sight, I had do something wrong on the above code ? Because when I am trying to use m_pPreviewInfo object in CMyCustomPrintPreview::OnDraw, is crashing and I get an access violation on:
C++
_AFXEXT_INLINE UINT CPrintInfo::GetMaxPage() const
	{ return m_pPD->m_pd.nMaxPage; }

Thank you.
GeneralRe: PRINTDLG to CPrintInfo Pin
Richard MacCutchan25-Sep-14 3:51
mveRichard MacCutchan25-Sep-14 3:51 
GeneralRe: PRINTDLG to CPrintInfo Pin
_Flaviu25-Sep-14 21:10
_Flaviu25-Sep-14 21:10 
GeneralRe: PRINTDLG to CPrintInfo Pin
_Flaviu25-Sep-14 23:17
_Flaviu25-Sep-14 23:17 
GeneralRe: PRINTDLG to CPrintInfo Pin
Richard MacCutchan25-Sep-14 23:35
mveRichard MacCutchan25-Sep-14 23:35 
GeneralRe: PRINTDLG to CPrintInfo Pin
_Flaviu25-Sep-14 23:37
_Flaviu25-Sep-14 23:37 
GeneralRe: PRINTDLG to CPrintInfo Pin
Richard MacCutchan26-Sep-14 0:23
mveRichard MacCutchan26-Sep-14 0:23 
GeneralRe: PRINTDLG to CPrintInfo Pin
_Flaviu26-Sep-14 0:41
_Flaviu26-Sep-14 0:41 
Questionproblem with COM component Pin
john563221-Jul-14 21:34
john563221-Jul-14 21:34 
QuestionHow to Transfer the Particular Content from Notepad to Notepad from VC++ Pin
GopalaKrishnan Gunasekaran20-Jul-14 4:45
GopalaKrishnan Gunasekaran20-Jul-14 4:45 
AnswerRe: How to Transfer the Particular Content from Notepad to Notepad from VC++ Pin
Richard MacCutchan20-Jul-14 7:01
mveRichard MacCutchan20-Jul-14 7:01 
QuestionMessage Closed Pin
16-Jul-14 20:02
Jenkins Strader16-Jul-14 20:02 
QuestionOracle.DataAccess x32 in a Machine x64 Pin
Kit Fisto16-Jul-14 6:36
Kit Fisto16-Jul-14 6:36 
AnswerRe: Oracle.DataAccess x32 in a Machine x64 Pin
Dave Kreskowiak17-Jul-14 11:04
mveDave Kreskowiak17-Jul-14 11:04 
GeneralRe: Oracle.DataAccess x32 in a Machine x64 Pin
Kit Fisto23-Jul-14 5:55
Kit Fisto23-Jul-14 5:55 
QuestionHow to get type of Icon in system messages Pin
Member 1088174515-Jul-14 2:03
Member 1088174515-Jul-14 2:03 
SuggestionRe: How to get type of Icon in system messages Pin
Jochen Arndt15-Jul-14 2:48
professionalJochen Arndt15-Jul-14 2:48 
SuggestionRe: How to get type of Icon in system messages Pin
Richard MacCutchan15-Jul-14 3:40
mveRichard MacCutchan15-Jul-14 3:40 

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.