Results 1 to 8 of 8

Thread: [RESOLVED] Detect click on desktop !

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2005
    Posts
    157

    Resolved [RESOLVED] Detect click on desktop !

    Hello,


    Is a way or another to detect mouse click, mousedown or others on the desktop?


    Thanks in advance.

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Oct 2005
    Posts
    157

    Re: Detect click on desktop !

    No solutions? subclassing, listening to mouse?

  3. #3
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Detect click on desktop !

    I guess you could try installing a low-level mouse hook and in case you get a WM_LBUTTONDOWN or WM_LBUTTONUP you could check the mouse position and use WindowFromPoint to check if the window under the cursor is the desktop window.

    However you can not create a low-level mouse hook on Win9x/ME.

  4. #4
    Fanatic Member
    Join Date
    Mar 2002
    Location
    AUSTRALIA
    Posts
    603

    Re: Detect click on desktop !

    When the Desktop is clicked it appears to get focus (as it takes focus away from an app that had focus).
    Would that effect help in any way ?
    Would GetForegroundWindow be of any use ?

    Wild thoughts from -
    - Left field
    - Left brain
    - Should be Left alone
    Rob C

  5. #5
    Frenzied Member zynder's Avatar
    Join Date
    Nov 2006
    Location
    localhost
    Posts
    1,434

    Re: Detect click on desktop !

    The SetWindowsHookEx API should be of help. There's no way you can detect mouse click when your lost focus on your app that's receiving the events just as Rob C stated.

    Link

    http://msdn2.microsoft.com/en-us/library/ms644990.aspx

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Oct 2005
    Posts
    157

    Re: Detect click on desktop !

    Indeed, I've tried to subclass the desktop how I can. The results were bad, were nulls! I lost focus from my application before any things could happen.

    A low-level subclassing is interesting... I'm going to try that...

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Oct 2005
    Posts
    157

    Resolved Re: Detect click on desktop !

    This goes well, thanks!

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Oct 2005
    Posts
    157

    Re: Detect click on desktop !

    Can we have two simultaneous message as mouse_middle_button_down and mouse_left_button_down?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width