Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. MFC focus question

MFC focus question

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    FredrickNorge
    wrote on last edited by
    #1

    I have a question in regards to, if there is a built in function in mfc i can overload that gets called when a dialog is brought back to focus after a DoModal() operation. I end the modal dialog with OnOK(). the OnPaint() starts to paint again when its brought back to focus, but is there is a cleaner way to check for this event? Thanks

    M S 2 Replies Last reply
    0
    • F FredrickNorge

      I have a question in regards to, if there is a built in function in mfc i can overload that gets called when a dialog is brought back to focus after a DoModal() operation. I end the modal dialog with OnOK(). the OnPaint() starts to paint again when its brought back to focus, but is there is a cleaner way to check for this event? Thanks

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      I'm not sure what  you're asking... As soon as DoModal() returns, the modal dialog has been dismissed.  While the modal dialog was displayed, other windows should still get WM_PAINT messages.  If you've halted painting before calling DoModal(), then just start painting again when DoModal() returns. Mark

      Mark Salsbery Microsoft MVP - Visual C++ :java:

      F 1 Reply Last reply
      0
      • M Mark Salsbery

        I'm not sure what  you're asking... As soon as DoModal() returns, the modal dialog has been dismissed.  While the modal dialog was displayed, other windows should still get WM_PAINT messages.  If you've halted painting before calling DoModal(), then just start painting again when DoModal() returns. Mark

        Mark Salsbery Microsoft MVP - Visual C++ :java:

        F Offline
        F Offline
        FredrickNorge
        wrote on last edited by
        #3

        The initial dialog does not paint when there is a modal dialog in focus, because i run the app in full screen. But if there are no functions that i can use that deals with "OnFocus", WM_PAINT works, i just need to be carefull with it. Thanks Fredrick

        1 Reply Last reply
        0
        • F FredrickNorge

          I have a question in regards to, if there is a built in function in mfc i can overload that gets called when a dialog is brought back to focus after a DoModal() operation. I end the modal dialog with OnOK(). the OnPaint() starts to paint again when its brought back to focus, but is there is a cleaner way to check for this event? Thanks

          S Offline
          S Offline
          Stephen Hewitt
          wrote on last edited by
          #4

          You could use the WM_ACTIVATE[^] message. Use a handler which looks something like this:

          void CDialogAppDlg::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized)
          {
          CDialog::OnActivate(nState, pWndOther, bMinimized);

          if (nState==WA\_ACTIVE || nState==WA\_CLICKACTIVE)
          {
          	// Do stuff here!
          }
          

          }

          Steve

          F 1 Reply Last reply
          0
          • S Stephen Hewitt

            You could use the WM_ACTIVATE[^] message. Use a handler which looks something like this:

            void CDialogAppDlg::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized)
            {
            CDialog::OnActivate(nState, pWndOther, bMinimized);

            if (nState==WA\_ACTIVE || nState==WA\_CLICKACTIVE)
            {
            	// Do stuff here!
            }
            

            }

            Steve

            F Offline
            F Offline
            FredrickNorge
            wrote on last edited by
            #5

            Perfect, just what i needed. Thanks!

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups