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. WM_CAPTURECHANGED, lParam=0

WM_CAPTURECHANGED, lParam=0

Scheduled Pinned Locked Moved C / C++ / MFC
question
6 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.
  • C Offline
    C Offline
    cowwoc2002
    wrote on last edited by
    #1

    Hi, I am getting WM_CAPTURECHANGED messages with lParam=0 and then my WindowProc stops getting messages (because my focus has disappeared). How is this legal? lParam is supposed to contain the HWND of the window that stole focus away from my WindowProc but it is zero which is an illegal value. How do I find out who has taken focus? Is this documented anywhere? Thank you, Gili

    D R 2 Replies Last reply
    0
    • C cowwoc2002

      Hi, I am getting WM_CAPTURECHANGED messages with lParam=0 and then my WindowProc stops getting messages (because my focus has disappeared). How is this legal? lParam is supposed to contain the HWND of the window that stole focus away from my WindowProc but it is zero which is an illegal value. How do I find out who has taken focus? Is this documented anywhere? Thank you, Gili

      D Offline
      D Offline
      darkbyte
      wrote on last edited by
      #2

      Don't know if this is documented somwhere but this sounds like Screen Saver attempt at getting the focus before actually going in Screen Saver mode.

      A 1 Reply Last reply
      0
      • D darkbyte

        Don't know if this is documented somwhere but this sounds like Screen Saver attempt at getting the focus before actually going in Screen Saver mode.

        A Offline
        A Offline
        Anonymous
        wrote on last edited by
        #3

        This is actually what you get when you click on the desktop and drag a rectangle. So, to answer your previous post, it isn't some sort of screensaver... but something is taking the focus away from the desktop. I will keep on looking.

        1 Reply Last reply
        0
        • C cowwoc2002

          Hi, I am getting WM_CAPTURECHANGED messages with lParam=0 and then my WindowProc stops getting messages (because my focus has disappeared). How is this legal? lParam is supposed to contain the HWND of the window that stole focus away from my WindowProc but it is zero which is an illegal value. How do I find out who has taken focus? Is this documented anywhere? Thank you, Gili

          R Offline
          R Offline
          Ryan Binns
          wrote on last edited by
          #4

          I think you're getting focus and mouse capture confused. They are not the same thing. To check for a focus change, you'll need to handle WM_KILLFOCUS, not WM_CAPTURECHANGED. Hope this helps,

          Ryan

          "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

          C 1 Reply Last reply
          0
          • R Ryan Binns

            I think you're getting focus and mouse capture confused. They are not the same thing. To check for a focus change, you'll need to handle WM_KILLFOCUS, not WM_CAPTURECHANGED. Hope this helps,

            Ryan

            "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

            C Offline
            C Offline
            cowwoc2002
            wrote on last edited by
            #5

            Sorry, you are right. I believe what is going on is that upon the user clicking and dragging inside the window, WM_CAPTURECHANGED is received indicating that the mouse capture has been released (that's probably what lParam=0 means). The problem, then, is that WM_MOUSEMOVE messages are being posted on the event-queue but my WindowProc never receives them. I am subclassing some other window. My guess is that the window calls GetMessage(), sees WM_MOUSEMOVE, and handles it internally without passing it on to the WindowProc. This poses a problem for me because I absolutely must subclass WM_MOUSEMOVE. Any ideas? Gili

            R 1 Reply Last reply
            0
            • C cowwoc2002

              Sorry, you are right. I believe what is going on is that upon the user clicking and dragging inside the window, WM_CAPTURECHANGED is received indicating that the mouse capture has been released (that's probably what lParam=0 means). The problem, then, is that WM_MOUSEMOVE messages are being posted on the event-queue but my WindowProc never receives them. I am subclassing some other window. My guess is that the window calls GetMessage(), sees WM_MOUSEMOVE, and handles it internally without passing it on to the WindowProc. This poses a problem for me because I absolutely must subclass WM_MOUSEMOVE. Any ideas? Gili

              R Offline
              R Offline
              Ryan Binns
              wrote on last edited by
              #6

              cowwoc2002 wrote: My guess is that the window calls GetMessage(), sees WM_MOUSEMOVE, and handles it internally without passing it on to the WindowProc. That would be my guess as well. One way to get around this is to install a WH_GETMESSAGE hook, which will get called whenever a message is retrieved from the message queue.

              Ryan

              "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

              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