Error in Create Dialog
-
Hi Friends, I am creating the dialog in my application. in that using CreateSolidBrush() to paint the dialog. But CreateDialog() is throwing an exception(wingdi.cpp).If i comment CreateSolidBrush()it works fine. what could be the problem?
Reagards Shiva
-
Hi Friends, I am creating the dialog in my application. in that using CreateSolidBrush() to paint the dialog. But CreateDialog() is throwing an exception(wingdi.cpp).If i comment CreateSolidBrush()it works fine. what could be the problem?
Reagards Shiva
-
m_DlgClr.CreateSolidBrush(RGB(97,129,175)); I am creating it in OnInitDialog(). and in OnCtlColor(,,) HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); if(nCtlColor == CTLCOLOR_DLG) return m_DlgClr; return hbr;
Reagards Shiva
-
m_DlgClr.CreateSolidBrush(RGB(97,129,175)); I am creating it in OnInitDialog(). and in OnCtlColor(,,) HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); if(nCtlColor == CTLCOLOR_DLG) return m_DlgClr; return hbr;
Reagards Shiva
m_DlgClr is a CBrush?
Greetings. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you “The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson Rating helpfull answers is nice, but saying thanks can be even nicer.
-
m_DlgClr.CreateSolidBrush(RGB(97,129,175)); I am creating it in OnInitDialog(). and in OnCtlColor(,,) HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); if(nCtlColor == CTLCOLOR_DLG) return m_DlgClr; return hbr;
Reagards Shiva
-
m_DlgClr is a CBrush?
Greetings. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you “The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson Rating helpfull answers is nice, but saying thanks can be even nicer.
Ya..
Reagards Shiva
-
Where is it crashing ?? In OnCtlColor() dont call base class version always call only in else part.
I traced it.Its crashing in following code. BOOL CWnd::CreateDlgIndirect(LPCDLGTEMPLATE lpDialogTemplate, CWnd* pParentWnd, HINSTANCE hInst) { ASSERT(lpDialogTemplate != NULL); if (pParentWnd != NULL) ASSERT_VALID(pParentWnd); . . . . . hWnd = ::CreateDialogIndirect(hInst, lpDialogTemplate, (CRASH)-----> pParentWnd->GetSafeHwnd(), AfxDlgProc);
Reagards Shiva
-
Ya..
Reagards Shiva
Try create brush in constructor instead of OnInitDialog.
-
Try create brush in constructor instead of OnInitDialog.
I tried it.It wont paint the dialog.
Reagards Shiva
-
m_DlgClr.CreateSolidBrush(RGB(97,129,175)); I am creating it in OnInitDialog(). and in OnCtlColor(,,) HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); if(nCtlColor == CTLCOLOR_DLG) return m_DlgClr; return hbr;
Reagards Shiva
Shivarudrayya H wrote:
I am creating it in OnInitDialog().
What does this method look like?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
m_DlgClr.CreateSolidBrush(RGB(97,129,175)); I am creating it in OnInitDialog(). and in OnCtlColor(,,) HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); if(nCtlColor == CTLCOLOR_DLG) return m_DlgClr; return hbr;
Reagards Shiva
Did you write this line on the OnInitDialog? m_DlgClr.CreateSolidBrush(RGB(97,129,175)); I am creating it in OnInitDialog().
-
Did you write this line on the OnInitDialog? m_DlgClr.CreateSolidBrush(RGB(97,129,175)); I am creating it in OnInitDialog().
ya..
Reagards Shiva
-
ya..
Reagards Shiva
Why you dont insert it on the constructor of your project?
-
Why you dont insert it on the constructor of your project?
As i said earlier it wont paint the dialog.
Reagards Shiva
-
As i said earlier it wont paint the dialog.
Reagards Shiva
I guess your problem is of Onctlcolor.