Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

GDI error, and windows can not show a dialog when using CProgressCtrl

$
0
0

I use VS2012 in windows7

I draw 128 CProgressCtrl in a windows, and a button to show a simple dialog(only has 'ok' and 'cancel' buttons)

the problem is if I draw more then 35 CProgressCtrl, when click the button to show the dialog, the dialog is not show, the message is stuck. 

the code is like:

//.h file

private:
	CCylinderProgressCtrlST * m_prg[128];

	CCylinderProgressCtrlST		m_prgBin0;
	CCylinderProgressCtrlST		m_prgBin1;
	CCylinderProgressCtrlST		m_prgBin2;
        ...
	CCylinderProgressCtrlST		m_prgBin127;

//.cpp file
	CDialog::OnInitDialog();

	m_prg[0] = &m_prgBin0;
	m_prg[1] = &m_prgBin1;
        ...
	m_prg[127] = &m_prgBin127;

        //here is 35
	for (int i = 0; i < 35; ++i)
	{
		if (m_prg[i])
		{
			m_prg[i]->SetRange32(0, 3000);
			m_prg[i]->SetStep(1);

			//set pos here, then the problem occurs
			m_prg[i]->SetPos(1000);
		}
	}

if I remove m_prg[i]->SetPos(1000); or show less then 35 CProgressCtrl, there has np, windows will show the dialog immediately

And I found another interesting thing:

1. set the CProgressCtrl number 35, and rebuild project, it has the problem

2. set the CProgressCtrl number 30, and rebuild project, it has np

3. set the CProgressCtrl number 35 again, and BUILD project, it has NO problem

btw, I have tested the GDI memory leak with Deleaker standalone, nothing found


Viewing all articles
Browse latest Browse all 15302

Trending Articles