Click here to Skip to main content
15,895,142 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
AnswerRe: Wrapper Class Pin
«_Superman_»21-Jul-10 23:12
professional«_Superman_»21-Jul-10 23:12 
AnswerRe: Wrapper Class Pin
Aescleal21-Jul-10 23:13
Aescleal21-Jul-10 23:13 
Questionswap two values withou using temp. storage Pin
lgmanuel21-Jul-10 20:10
lgmanuel21-Jul-10 20:10 
AnswerRe: swap two values withou using temp. storage PinPopular
«_Superman_»21-Jul-10 20:25
professional«_Superman_»21-Jul-10 20:25 
AnswerRe: swap two values withou using temp. storage Pin
Luc Pattyn21-Jul-10 20:26
sitebuilderLuc Pattyn21-Jul-10 20:26 
AnswerRe: swap two values withou using temp. storage [modified] PinPopular
Nuri Ismail21-Jul-10 20:29
Nuri Ismail21-Jul-10 20:29 
GeneralRe: swap two values withou using temp. storage PinPopular
Emilio Garavaglia21-Jul-10 21:41
Emilio Garavaglia21-Jul-10 21:41 
GeneralRe: swap two values withou using temp. storage [modified] Pin
Nuri Ismail21-Jul-10 21:55
Nuri Ismail21-Jul-10 21:55 
GeneralRe: swap two values withou using temp. storage Pin
patbob23-Jul-10 7:04
patbob23-Jul-10 7:04 
GeneralRe: swap two values withou using temp. storage Pin
Aescleal21-Jul-10 22:10
Aescleal21-Jul-10 22:10 
GeneralRe: swap two values withou using temp. storage Pin
Nuri Ismail21-Jul-10 22:19
Nuri Ismail21-Jul-10 22:19 

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.