Click here to Skip to main content
15,910,471 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questioninheritance question Pin
lune1222-Jul-10 3:37
lune1222-Jul-10 3:37 
AnswerRe: inheritance question Pin
Niklas L22-Jul-10 4:54
Niklas L22-Jul-10 4:54 
AnswerRe: inheritance question Pin
Aescleal22-Jul-10 5:11
Aescleal22-Jul-10 5:11 
GeneralRe: inheritance question Pin
Niklas L22-Jul-10 6:03
Niklas L22-Jul-10 6:03 
GeneralRe: inheritance question Pin
Moak22-Jul-10 14:30
Moak22-Jul-10 14:30 
GeneralRe: inheritance question Pin
Aescleal22-Jul-10 20:15
Aescleal22-Jul-10 20:15 
GeneralRe: inheritance question Pin
Moak23-Jul-10 0:25
Moak23-Jul-10 0:25 
GeneralRe: inheritance question Pin
Niklas L22-Jul-10 22:44
Niklas L22-Jul-10 22:44 
GeneralRe: inheritance question Pin
Aescleal22-Jul-10 20:17
Aescleal22-Jul-10 20:17 
GeneralRe: inheritance question Pin
Niklas L22-Jul-10 23:11
Niklas L22-Jul-10 23:11 
GeneralRe: inheritance question Pin
Aescleal23-Jul-10 4:13
Aescleal23-Jul-10 4:13 
GeneralRe: inheritance question Pin
Niklas L23-Jul-10 11:36
Niklas L23-Jul-10 11:36 
GeneralRe: inheritance question Pin
Aescleal23-Jul-10 19:36
Aescleal23-Jul-10 19:36 
Questionhow to play audio and video Pin
MKC00222-Jul-10 3:11
MKC00222-Jul-10 3:11 
AnswerRe: how to play audio and video Pin
Cool_Dev22-Jul-10 3:19
Cool_Dev22-Jul-10 3:19 
GeneralRe: how to play audio and video Pin
MKC00222-Jul-10 23:18
MKC00222-Jul-10 23:18 
GeneralRe: how to play audio and video Pin
Cool_Dev3-Aug-10 2:24
Cool_Dev3-Aug-10 2:24 
QuestionMaking a driver WITHOUT wdf [Solved myself!] Pin
Iain Clarke, Warrior Programmer22-Jul-10 2:51
Iain Clarke, Warrior Programmer22-Jul-10 2:51 
QuestionPrintPreview in MFC SDI Application Pin
tony_Udz21-Jul-10 23:05
tony_Udz21-Jul-10 23:05 
Hi,

I am facing problem in my project and to simulate this problem I have reproduced in sample application.

I have created a SDI MFC app with doc view architecture.
I am facing problem while Print preview.
While I close the preview Window, application hangs and after some time it crashed.
Following is the implementation of OnFilePrintPreview and OnEndPrintPreview:

void CSampleView::OnFilePrintPreview()
{
// must not create this on the frame. Must outlive this function
CPrintPreviewState* pState = new CPrintPreviewState;


// temporary remove the parent so that the DoPrintPreview() uses the mainframe
ShowWindow(SW_HIDE);

SetParent(NULL);


//AfxMessageBox("Before DoPrintPreview");
if (!DoPrintPreview(AFX_IDD_PREVIEW_TOOLBAR, this,
RUNTIME_CLASS(CPreviewView), pState))
{
//AfxMessageBox("After DoPrintPreview IF");
// In derived classes, reverse special window handling here for
// Preview failure case

TRACE0("Error: DoPrintPreview failed.\n");
AfxMessageBox(AFX_IDP_COMMAND_FAILURE);
delete pState; // preview failed to initialize, delete State now
}

//AfxMessageBox("After DoPrintPreview");

}

void CSampleView::OnEndPrintPreview( CDC* pDC, CPrintInfo* pInfo, POINT point, CPreviewView* pView)
{

pView->DestroyWindow();

SetParent(AfxGetApp()->m_pMainWnd);

AfxGetApp()->m_pMainWnd->ShowWindow(SW_SHOW);
AfxGetApp()->m_pMainWnd->UpdateWindow();

}

Please provide input on this if anybody has any idea on this.
Thanks in Advance!!

Regards,
Tony
AnswerRe: PrintPreview in MFC SDI Application Pin
ErnestoNet22-Jul-10 7:23
ErnestoNet22-Jul-10 7:23 
GeneralRe: PrintPreview in MFC SDI Application Pin
tony_Udz22-Jul-10 18:54
tony_Udz22-Jul-10 18:54 
GeneralRe: PrintPreview in MFC SDI Application Pin
ErnestoNet23-Jul-10 2:19
ErnestoNet23-Jul-10 2:19 
QuestionWrapper Class Pin
Benjamin Bruno21-Jul-10 22:39
Benjamin Bruno21-Jul-10 22:39 
AnswerRe: Wrapper Class Pin
Sauro Viti21-Jul-10 22:44
professionalSauro Viti21-Jul-10 22:44 
AnswerRe: Wrapper Class Pin
Niklas L21-Jul-10 23:01
Niklas L21-Jul-10 23:01 

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.