Mouse OutSide A Form

Discussion in 'Questions (Windows Mobile)' started by eww245, Apr 25, 2009.

  1. eww245

    eww245 Member Licensed User

    I thought there was a discussion about detecting it.

    Can someone give me a link?
  2. klaus

    klaus Expert Licensed User

    This happens only with MouseMove and MouseUp on the desktop.
    If you want to avoid getting values from outsides you must check if x and y are insides the form limits.
    If x >=0 and x<= Form.Width and y>= 0 and y<=Form.Height Then
    Be aware that there is also a difference in the behaviour of the MouseMove event between the desktop and the device. On the desktop the MousMove event is fired even without a MouseDown event, on the device the MouseMove event is only fired after a MouseDown event (the contact of the stylus is needed). To avoid this you should add a flag in the MousDown event, test it in the MouseMove event and set it back in the MousUp event:
    Sub Form_MouseDown(x,y)
      FlagMouse = 
    End Sub
    Sub Form_MouseMove(x,y)
    If FlagMouse = 1 Then
    End If
    End Sub
    Sub Form_MouseUp(x,y)
      FlagMouse = 
    End Sub
    Best regards.
  3. eww245

    eww245 Member Licensed User

    Thanks for the response.

    I was actually hoping it was possible on the device.

    I was having issues with a PInvoke to GetIdleTime / GetTickTime.
    It wasn't working the way I hoped.
    And thought if I could detect when there were no clicks outside a form, it would achieve the same.

    I have since worked out the correct calculation and works great.

    Thanks Anyway
  4. Mr_Gee

    Mr_Gee Active Member Licensed User

    I'm still tring to get this to work on the desktop, but i can only get the mousemove to trigger when it is on the form...

    probably because i'm using sub form1_mousemove(x,y)..
  5. Byak@

    Byak@ Active Member Licensed User

  6. Mr_Gee

    Mr_Gee Active Member Licensed User


    Thanks Byak@,

    Any chance you also know how to get the pixel color
    at a specific position, also outside of the form?

    I've been fiddling with the door lib... but it is not my day
  7. Byak@

    Byak@ Active Member Licensed User

    emm...i'm not find it in msdn =(
    but you can get screenshot with dzHW.dll and get mouse position.and now you can get pixel color.but this method not fast.
  8. Mr_Gee

    Mr_Gee Active Member Licensed User

    that was my next option... hopefully someone else reads this..
    or i might make a new post

  9. Mr_Gee

    Mr_Gee Active Member Licensed User

    In case anyone is wondering, the above worked,
    e.g. I'm taking a screenshot of 1x1 pixel and checking the RGB color
    with Agraham's ImageEX lib...
    Put this sub on a timer and presto... a color picker :)
  10. Ariel_Z

    Ariel_Z Active Member Licensed User

    Thank you. It's a good and interesting solution.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice