|
-
January 16th, 2013, 01:15 AM
#10
Re: Resource Exception
Hi Victor,
Your Code is Amazing. Really... 
Three solutions are working good. But Compare to other solution, this code is very short.
Here I upload my code for who one have resource exception,
Code:
HBRUSH CDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
TCHAR classname[MAX_PATH];
if(::GetClassName(pWnd->m_hWnd, classname, MAX_PATH) == 0)
return hbr;
if(_tcsicmp(classname, _T("BUTTON")) == 0) //Don't set the Background colour for my button
return hbr;
pDC->SetBkColor(MYCOLOR);
pDC->SetTextColor(RGB(128, 255, 0));
if((HBRUSH)brush == NULL)
brush.CreateSolidBrush(RGB(0,0,0));
return (HBRUSH) brush;
}
BOOL CDlg::OnEraseBkgnd(CDC* pDC)
{
CRect rcClient;
GetClientRect(&rcClient);
if((HBRUSH)brush == NULL)
brush.CreateSolidBrush(MYCOLOR);
pDC->FillRect(&rcClient, &brush);
brush.DeleteObject();
return TRUE;
}
Thanks Victor
Regards,
SaraswathiSrinath
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|