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

Thread: OnIdle processing

  1. #1
    Join Date
    Jun 2006

    OnIdle processing


    Just a simple question..A dialog based MFC application does not seem to handle OnIde() processing even if you override OnIdle(). But a SDI or MDI app does. Why is this so? Thanks in advance..

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Wallisellen (ZH), Switzerland

    Re: OnIdle processing

    It is by design of MFC: CWinApp::OnIdle and CWinApp::Run are called only after the CWinApp::InitInstance returns TRUE. But in a dialog based App InitInstance returns after the dialog exits, so it doesn't make any sense call Run nor OnIdle.
    Instead the dialog uses its own message loop (but without OnIdle). You can, however, implement you own "idle" processing using WM_KICKIDLE (or/and WM_IDLEUPDATECMDUI) message. See
    Victor Nijegorodov

  3. #3
    Join Date
    Nov 2000
    Voronezh, Russia

    Re: OnIdle processing

    Another approach could be to use the dialog modeless instead of running DoModal. This way the dialog becomes main window, with OnIdle available in application class. The attached sample provides minimal framework needed for such an app proper functioning.
    Attached Files Attached Files
    Best regards,

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This is a Codeguru.com survey!

HTML5 Development Center