CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Modeless dialog

  1. #1
    Guest

    Modeless dialog

    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!


  2. #2
    Join Date
    May 1999
    Posts
    92

    Re: Modeless dialog

    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?


  3. #3
    Join Date
    Apr 1999
    Posts
    5

    Re: Modeless dialog

    It sounds as if you are calling the Invalidate function within the OnPaint function. Never to that.


  4. #4
    Join Date
    May 1999
    Posts
    78

    Re: Modeless dialog

    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


  5. #5
    Guest

    Re: Modeless dialog

    Did you suppress the Paint object created by default in the OnPaint method?
    You must keep it otherwise you will loop like you said.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured