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. How to detect double-click on desktop window?

How to detect double-click on desktop window?

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
4 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.
  • P Offline
    P Offline
    PatrykDabrowski
    wrote on last edited by
    #1

    Hello! I'm trying to find out how to detect double clicks on desktop screen. I could use GetKeyState() and make some calculations to detect 'global' double-click, but this would include clicks on buttons, icons and other items. I want to detect ONLY that double-clicks which are not connected with any action (those messages which system is not passing to any other application neither interpret by its own like double-clicks on icons). Should I use global hooks? SetWindowsHookEx(WH_MOUSE, MouseProc, tInstance, NULL) would fit if I could filter-out application/icons connected doubleclicks. Thanks for any help:) Pat

    D 1 Reply Last reply
    0
    • P PatrykDabrowski

      Hello! I'm trying to find out how to detect double clicks on desktop screen. I could use GetKeyState() and make some calculations to detect 'global' double-click, but this would include clicks on buttons, icons and other items. I want to detect ONLY that double-clicks which are not connected with any action (those messages which system is not passing to any other application neither interpret by its own like double-clicks on icons). Should I use global hooks? SetWindowsHookEx(WH_MOUSE, MouseProc, tInstance, NULL) would fit if I could filter-out application/icons connected doubleclicks. Thanks for any help:) Pat

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      This is a complete SWAG, but once you detect a mouse click on a window, can you check to see if: 1) it has no parent, and 2) it belongs to the "#32769" class?


      "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

      "Judge not by the eye but by the heart." - Native American Proverb

      P 1 Reply Last reply
      0
      • D David Crow

        This is a complete SWAG, but once you detect a mouse click on a window, can you check to see if: 1) it has no parent, and 2) it belongs to the "#32769" class?


        "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

        "Judge not by the eye but by the heart." - Native American Proverb

        P Offline
        P Offline
        PatrykDabrowski
        wrote on last edited by
        #3

        Hmmm... Lets assume hooking to the global mouse messages via SetWindowsHookEx(WH_MOUSE,....). I would get ALL mouse messages. Is this MSG structure enough to detect double-click on 'free' desktop window? typedef struct { HWND hwnd; UINT message; WPARAM wParam; LPARAM lParam; DWORD time; POINT pt; } MSG, *PMSG; My pseudo-code would be like this: if((pMsg->message==WM_LBUTTONDBLCLK) && (pMsg->hwnd==::GetDesktopWindow())) { // we've got double-click on desktop, not on any other window/icon?? } Do You think that's enough? I wonder what pMsg->hwnd would be if I double-click on "my computer" icon?? Would it be the same? (::GetDesktopWindow()) Pat.

        C 1 Reply Last reply
        0
        • P PatrykDabrowski

          Hmmm... Lets assume hooking to the global mouse messages via SetWindowsHookEx(WH_MOUSE,....). I would get ALL mouse messages. Is this MSG structure enough to detect double-click on 'free' desktop window? typedef struct { HWND hwnd; UINT message; WPARAM wParam; LPARAM lParam; DWORD time; POINT pt; } MSG, *PMSG; My pseudo-code would be like this: if((pMsg->message==WM_LBUTTONDBLCLK) && (pMsg->hwnd==::GetDesktopWindow())) { // we've got double-click on desktop, not on any other window/icon?? } Do You think that's enough? I wonder what pMsg->hwnd would be if I double-click on "my computer" icon?? Would it be the same? (::GetDesktopWindow()) Pat.

          C Offline
          C Offline
          Cristian Amarie
          wrote on last edited by
          #4

          Use spy++ utility and check the message(s) when double-clicking My computer icon. Me I think the message is for the SHELLDLL_DefView/SysListView32 classes that displays the icons, and not for #32769 desktop window.

          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