Click to See Complete Forum and Search --> : Modeless dialog
April 23rd, 1999, 07:03 AM
I create a modeless dialog in a window,and I overload the function "OnPaint".
At begin it works correctly.However,when I create this dialog ,the dialog abruptly repaint itself endlessly,(I use debug to confirm it) and the cpu's usage is 100%.So I can't do anything!How can I avoid this thing? Thanks a lot!
delbert Harry
April 23rd, 1999, 11:19 AM
If you have a dialog that paints continously maybe you need to put a BOOLEAN variable in the class header and then use the boolean variable to make the onpaint function do something or not?
Mike Weber
April 23rd, 1999, 12:21 PM
It sounds as if you are calling the Invalidate function within the OnPaint function. Never to that.
Saeed R
May 9th, 1999, 10:48 PM
Say your dialog modeless is Cwaitdlg then
BOOL CWaitDlg::Create()
{
return CDialog::Create(CWaitDlg::IDD);
}
and
use
waitdlg=new CWaitDlg();
waitdlg->Create();
//do your stuff
delete waitdlg;//kill it
Hope this helps
June 29th, 1999, 02:46 PM
Did you suppress the Paint object created by default in the OnPaint method?
You must keep it otherwise you will loop like you said.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.