Click here to Skip to main content
15,914,231 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Can't get a file path from a windows dialog and pass it too a directX api call Pin
Hamid_RT6-Oct-06 19:20
Hamid_RT6-Oct-06 19:20 
GeneralRe: Can't get a file path from a windows dialog and pass it too a directX api call Pin
BarryOg7-Oct-06 1:38
BarryOg7-Oct-06 1:38 
GeneralRe: Can't get a file path from a windows dialog and pass it too a directX api call Pin
Hamid_RT7-Oct-06 2:48
Hamid_RT7-Oct-06 2:48 
GeneralRe: Can't get a file path from a windows dialog and pass it too a directX api call Pin
BarryOg7-Oct-06 4:09
BarryOg7-Oct-06 4:09 
QuestionwaveOutGetID [modified] Pin
kk30036-Oct-06 11:51
kk30036-Oct-06 11:51 
QuestionCreateProcess() anomaly Pin
neilsolent6-Oct-06 9:21
neilsolent6-Oct-06 9:21 
QuestionAuthFilt always display the logon page Pin
Will88888886-Oct-06 8:49
Will88888886-Oct-06 8:49 
QuestionImage sequence display in Dialog [modified] Pin
Bighand20006-Oct-06 7:22
Bighand20006-Oct-06 7:22 
I have a number of images(100 or more) that need to be processed and displayed using MFC. The processing is very cpu intensive. I process the images in the main dialog, and display the result images in a child dialog, by calling the the Invalidate() and UpdateWindow() pair to redraw the child dialog after the processing of each image. And now the program is single threaded.

But the display freezes after some frames has been displayed correctly.

In the OnPaint() of the child dialog, I call this function:

void CDisplayDlg::ShowBitmap(CPaintDC *pdc, CBitmap* pBitmap)
{	
	
	BITMAP bm;
	
	pBitmap->GetBitmap(&bm);
	CDC dcMem;

	dcMem.CreateCompatibleDC(pdc);
	
	CBitmap* pOldBitmap=(CBitmap*) dcMem.SelectObject(pBitmap);
   	
	//Copy and resize the bitmap to the dialog window
	pdc->BitBlt(0,0,bm.bmWidth,bm.bmHeight,&dcMem,0,0,SRCCOPY);
	dcMem.SelectObject( pOldBitmap);
	DeleteDC(dcMem);
	
}


And this is the OnPaint():

void CDisplayDlg::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
        // TODO: Add your message handler code here
	CFADlg *pWnd = (CFADlg *)GetParent();
	if(pWnd)
	{	
		//GDIPlusShowBitmap(&dc, &pWnd->m_bmpBitmap);
		ShowBitmap(&dc, &pWnd->m_bmpBitmap);
	}

	int m=ReleaseDC(&dc);
	TRACE("m: %d\n", m);
	// Do not call CDialog::OnPaint() for painting messages
}


After processing of all the images, the child dialog displays the last processed image. I have also tried using GDI+ to implement the showbitmap, but it has the same problem.

What should I do with this? At first I thought that was because I used up all the DC resources. Or maybe I need to use multithread it?

I will really appreciate any help from you. Thanks a lot!



-- modified at 14:21 Friday 6th October, 2006
AnswerRe: Image sequence display in Dialog Pin
led mike6-Oct-06 8:44
led mike6-Oct-06 8:44 
GeneralRe: Image sequence display in Dialog Pin
Bighand20006-Oct-06 9:19
Bighand20006-Oct-06 9:19 
AnswerRe: Image sequence display in Dialog Pin
Hamid_RT6-Oct-06 8:48
Hamid_RT6-Oct-06 8:48 
GeneralRe: Image sequence display in Dialog [modified] Pin
Bighand20006-Oct-06 9:22
Bighand20006-Oct-06 9:22 
GeneralRe: Image sequence display in Dialog Pin
Hamid_RT6-Oct-06 19:00
Hamid_RT6-Oct-06 19:00 
GeneralRe: Image sequence display in Dialog Pin
Bighand20007-Oct-06 4:29
Bighand20007-Oct-06 4:29 
GeneralRe: Image sequence display in Dialog Pin
Hamid_RT7-Oct-06 6:54
Hamid_RT7-Oct-06 6:54 
GeneralRe: Image sequence display in Dialog Pin
Bighand20007-Oct-06 16:52
Bighand20007-Oct-06 16:52 
GeneralRe: Image sequence display in Dialog Pin
Hamid_RT7-Oct-06 19:52
Hamid_RT7-Oct-06 19:52 
GeneralRe: Image sequence display in Dialog Pin
Bighand200010-Oct-06 11:55
Bighand200010-Oct-06 11:55 
GeneralRe: Image sequence display in Dialog Pin
Hamid_RT10-Oct-06 18:43
Hamid_RT10-Oct-06 18:43 
GeneralRe: Image sequence display in Dialog [modified] Pin
Bighand200021-Oct-06 15:37
Bighand200021-Oct-06 15:37 
GeneralRe: Image sequence display in Dialog Pin
Hamid_RT22-Oct-06 1:28
Hamid_RT22-Oct-06 1:28 
QuestionElegant solution for alignment Pin
Andre xxxxxxx6-Oct-06 7:10
Andre xxxxxxx6-Oct-06 7:10 
AnswerRe: Elegant solution for alignment Pin
led mike6-Oct-06 8:39
led mike6-Oct-06 8:39 
GeneralRe: Elegant solution for alignment Pin
Andre xxxxxxx6-Oct-06 9:34
Andre xxxxxxx6-Oct-06 9:34 
GeneralRe: Elegant solution for alignment Pin
led mike6-Oct-06 9:37
led mike6-Oct-06 9:37 

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.