Question

The following code works fine:

for(int i=0; i<500; i++) {
for(int j=0; j<100; j++) {
m_title.SetWindowText(_T("lol"));
}
}

But when I set a background color for the dialog:

HBRUSH CTaggingDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) {
return CreateSolidBrush(RGB(0,0,0));//BLACK
}

The loop above causes the program to hit a breakpoint in wingdi.cpp at:

CPaintDC::CPaintDC(CWnd* pWnd)

How do I set a background color for the dialog without having it crash?

Was it helpful?

Solution

Never mind. By changing the way I set the background color to the method in this article:

http://www.codeguru.com/cpp/w-d/dislog/background/article.php/c1895

The problem has been resolved.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top