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. Focus / Not Focused

Focus / Not Focused

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelp
5 Posts 2 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.
  • Y Offline
    Y Offline
    YaronNir
    wrote on last edited by
    #1

    Hi all, I have a dialog with the followings: 1) it is a modal dialog 2) it is always on top 3) it has no frame (style = popup, border = none) my question is this, when the dialog has focus (which means i am clicking over it or moving my mouse over is) i want to do one thing, but when the focus leaves the dialog (click somewhere else, or move mouse somewhere else) i want to do something else..... i tried to catch these messages and it didn't work properly: 1) WM_SETFOCUS/ WM_KILLFOCUS 2) WM_ACTIVATE / WM_ACTIVATE_APP can any1 help me here? thanks in advanced Yaron

    M 1 Reply Last reply
    0
    • Y YaronNir

      Hi all, I have a dialog with the followings: 1) it is a modal dialog 2) it is always on top 3) it has no frame (style = popup, border = none) my question is this, when the dialog has focus (which means i am clicking over it or moving my mouse over is) i want to do one thing, but when the focus leaves the dialog (click somewhere else, or move mouse somewhere else) i want to do something else..... i tried to catch these messages and it didn't work properly: 1) WM_SETFOCUS/ WM_KILLFOCUS 2) WM_ACTIVATE / WM_ACTIVATE_APP can any1 help me here? thanks in advanced Yaron

      M Offline
      M Offline
      Mumiozol
      wrote on last edited by
      #2

      Try SetCapture to get mouse input even if it's outside of your dialog. To act only once when mouse cursor leaves dialog area try to catch WM_MOUSELEAVE, WM_NCMOUSELEAVE. Hope that's what you need. Mickey :)

      Y 1 Reply Last reply
      0
      • M Mumiozol

        Try SetCapture to get mouse input even if it's outside of your dialog. To act only once when mouse cursor leaves dialog area try to catch WM_MOUSELEAVE, WM_NCMOUSELEAVE. Hope that's what you need. Mickey :)

        Y Offline
        Y Offline
        YaronNir
        wrote on last edited by
        #3

        hi, thanks for reply. I don't know how to catch these messages, can you show me? thanks Yaron Ask not what your application can do for you, Ask what you can do for your application

        M 1 Reply Last reply
        0
        • Y YaronNir

          hi, thanks for reply. I don't know how to catch these messages, can you show me? thanks Yaron Ask not what your application can do for you, Ask what you can do for your application

          M Offline
          M Offline
          Mumiozol
          wrote on last edited by
          #4

          In your derived class MESSAGE_MAP section BEGIN_MESSAGE_MAP(CMyDialog, CDialog) ON_MESSAGE(WM_MOUSELEAVE,OnMouseLeave) END_MESSAGE_MAP() Mickey :)

          Y 1 Reply Last reply
          0
          • M Mumiozol

            In your derived class MESSAGE_MAP section BEGIN_MESSAGE_MAP(CMyDialog, CDialog) ON_MESSAGE(WM_MOUSELEAVE,OnMouseLeave) END_MESSAGE_MAP() Mickey :)

            Y Offline
            Y Offline
            YaronNir
            wrote on last edited by
            #5

            thanks :) Ask not what your application can do for you, Ask what you can do for your application

            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