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. OnKillFocus question

OnKillFocus question

Scheduled Pinned Locked Moved C / C++ / MFC
question
4 Posts 4 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.
  • J Offline
    J Offline
    Jake Palmer
    wrote on last edited by
    #1

    I'd like to do something if a view in my MDI app loses focus to another view, but not if it loses focus to a dialog or message box. OnKillFocus gives me a pointer to the new CWnd, so is there a safe way to check if that is a CView? thanks, Jake

    P B 2 Replies Last reply
    0
    • J Jake Palmer

      I'd like to do something if a view in my MDI app loses focus to another view, but not if it loses focus to a dialog or message box. OnKillFocus gives me a pointer to the new CWnd, so is there a safe way to check if that is a CView? thanks, Jake

      P Offline
      P Offline
      Paolo Messina
      wrote on last edited by
      #2

      I think you may use pWnd->IsKindOf(RUNTIME_CLASS(CView)) - look in MSDN for that function (from CObject). Paolo ------ "airplane is cool, but space shuttle is even better" (J. Kaczorowski)

      1 Reply Last reply
      0
      • J Jake Palmer

        I'd like to do something if a view in my MDI app loses focus to another view, but not if it loses focus to a dialog or message box. OnKillFocus gives me a pointer to the new CWnd, so is there a safe way to check if that is a CView? thanks, Jake

        B Offline
        B Offline
        Bret Faller
        wrote on last edited by
        #3

        You can try this: CWnd* m_wnd; (pointer you get from OnKillFocus) if (m_wnd->IsKindOf(RUNTIME_CLASS(CView))) // Its a CView else // Its not a CView Bret Faller Odyssey Computing, Inc.

        L 1 Reply Last reply
        0
        • B Bret Faller

          You can try this: CWnd* m_wnd; (pointer you get from OnKillFocus) if (m_wnd->IsKindOf(RUNTIME_CLASS(CView))) // Its a CView else // Its not a CView Bret Faller Odyssey Computing, Inc.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          I have an OnKillFocus handler on an edit control. If the user presses the window close ("x") button while the focus is on the control, I would like to handle the WM_CLOSE message, however the KillFocus message is being generated first. How can I either determine in the OnKillFocus handler that the user pressed the "x" button, or alternately, what message can I handle that would occur before the KillFocus. As a last resort, is there any way to disable the "x" button? 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