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. Hooking into mouse messages in a Command/MSDOS window

Hooking into mouse messages in a Command/MSDOS window

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

    I wrote a simple app that hooks WH_MOUSE events. The application receives a stream of events when the mouse is moved over most windows. However it does not get any events from: - the Command (MSDOS) application - the menu bar of old (16-bit?) applications such as Calculator or Paint. - the title bar of all apps How can catch mouse messages in these cases? -- Goop

    A _ 2 Replies Last reply
    0
    • G goop00

      I wrote a simple app that hooks WH_MOUSE events. The application receives a stream of events when the mouse is moved over most windows. However it does not get any events from: - the Command (MSDOS) application - the menu bar of old (16-bit?) applications such as Calculator or Paint. - the title bar of all apps How can catch mouse messages in these cases? -- Goop

      A Offline
      A Offline
      ATM CodeProject
      wrote on last edited by
      #2

      Please mention the problem clearly.

      G 1 Reply Last reply
      0
      • A ATM CodeProject

        Please mention the problem clearly.

        G Offline
        G Offline
        goop00
        wrote on last edited by
        #3

        Mmm, I thought I had :-) It seems that the Command/MSDOS window is capturing mouse movements before my application. As my application was started from that window, I assumed that my app would be earlier in the hook list and therefore receive messages first. But the app does not see the mouse movements for the Command window. I guess the problem goes deeper, because I want to see ALL mouse movements, wherever my hook is in the hooks list. So I guess I need to get the messages before any hook functions. Hope that is clearer :-) Regards -- Goop

        1 Reply Last reply
        0
        • G goop00

          I wrote a simple app that hooks WH_MOUSE events. The application receives a stream of events when the mouse is moved over most windows. However it does not get any events from: - the Command (MSDOS) application - the menu bar of old (16-bit?) applications such as Calculator or Paint. - the title bar of all apps How can catch mouse messages in these cases? -- Goop

          _ Offline
          _ Offline
          _Superman_
          wrote on last edited by
          #4

          Command/DOS applications do not have a message loop. But you should get mouse messages on title bars of Windows apps using this hook. If not you should try WH_MOUSE_LL.

          «_Superman_»

          G 1 Reply Last reply
          0
          • _ _Superman_

            Command/DOS applications do not have a message loop. But you should get mouse messages on title bars of Windows apps using this hook. If not you should try WH_MOUSE_LL.

            «_Superman_»

            G Offline
            G Offline
            goop00
            wrote on last edited by
            #5

            Thanks for your reply. You are right, messages really are received on title bars. I needed to test for the Non-Client messages, WM_NCRBUTTONDOWN, as well as for WM_RBUTTONDOWN. This also fixes it for the menu bars of Calculator/Paint. But the Command/MSDOS window still somehow captures messages - I see none of them, even for the title bar. How does it do this (ie. which API)? Does this mean that keyloggers also cannot intercept text typed into the Command window? This would imply that an application should grab the keyboard events directly (as in Command) to avoid snooping, eg during password entry. Regards -- Goop

            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