mouse move event

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Logan Mckinley

    #1

    mouse move event

    I need to be able to detect mouse movement even when it is not over my
    application. I can get the mouse cords using MousePosition but I am not
    sure if there is an event that hits my program when the mouse is not over my
    program.
    One idea i had was make a child form that was transparent and use the
    MouseMove event to keep that transparent window under the mouse but the
    transparent window did not catch the MouseMove event.
    I also tried putting a timer on the form that checks MousePosition but to
    make it smooth i would have to check it so often that it is to processor
    intensive.

    Any help is appriciated,
    Thanks in advance,
    ~Logan


  • Rafael J. Pellicer

    #2
    Re: mouse move event


    With API: GetCursorPos Lib "user32" Alias "GetCursorP os" (lpPoint As
    POINTAPI) As Long




    "Logan Mckinley" <logan@globalwe b.net> escribió en el mensaje
    news:eNMX5kMfDH A.1872@TK2MSFTN GP09.phx.gbl...[color=blue]
    > I need to be able to detect mouse movement even when it is not over my
    > application. I can get the mouse cords using MousePosition but I am not
    > sure if there is an event that hits my program when the mouse is not over[/color]
    my[color=blue]
    > program.
    > One idea i had was make a child form that was transparent and use the
    > MouseMove event to keep that transparent window under the mouse but the
    > transparent window did not catch the MouseMove event.
    > I also tried putting a timer on the form that checks MousePosition but to
    > make it smooth i would have to check it so often that it is to processor
    > intensive.
    >
    > Any help is appriciated,
    > Thanks in advance,
    > ~Logan
    >
    >[/color]


    Comment

    • Logan Mckinley

      #3
      Re: mouse move event

      Am i correct that this API will just return the location of the mouse? If
      so I am currently able to get that using "Cursor.Positio n". My problem is i
      need to query this every time the mouse moves and don't know the event that
      fires when the mouse is not over my form.
      Thanks,
      ~Logan

      "Rafael J. Pellicer" <rafaelpp@cantv .net> wrote in message
      news:%23SjD4yMf DHA.3228@tk2msf tngp13.phx.gbl. ..[color=blue]
      >
      > With API: GetCursorPos Lib "user32" Alias "GetCursorP os" (lpPoint As
      > POINTAPI) As Long
      >
      >
      >
      >
      > "Logan Mckinley" <logan@globalwe b.net> escribió en el mensaje
      > news:eNMX5kMfDH A.1872@TK2MSFTN GP09.phx.gbl...[color=green]
      > > I need to be able to detect mouse movement even when it is not over my
      > > application. I can get the mouse cords using MousePosition but I am not
      > > sure if there is an event that hits my program when the mouse is not[/color][/color]
      over[color=blue]
      > my[color=green]
      > > program.
      > > One idea i had was make a child form that was transparent and use the
      > > MouseMove event to keep that transparent window under the mouse but the
      > > transparent window did not catch the MouseMove event.
      > > I also tried putting a timer on the form that checks MousePosition but[/color][/color]
      to[color=blue][color=green]
      > > make it smooth i would have to check it so often that it is to processor
      > > intensive.
      > >
      > > Any help is appriciated,
      > > Thanks in advance,
      > > ~Logan
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Magnus Persson

        #4
        Re: mouse move event

        You need to "Capture" the mouse, otherwise you will not receive mouse events
        when pointer is outside your window.
        To do this you set the Capture property of your form to true. When ever your
        application looses focus you should set the Capture property back to false.

        Normally you only use this "capture" function in controls within a form. If
        you capture mouse events outside your main form I guess you need to pass the
        events on to the window that the mouse hoovers.

        /Magnus

        "Logan Mckinley" <logan@globalwe b.net> wrote in message
        news:OGC6sFNfDH A.956@TK2MSFTNG P09.phx.gbl...[color=blue]
        > Am i correct that this API will just return the location of the mouse? If
        > so I am currently able to get that using "Cursor.Positio n". My problem is[/color]
        i[color=blue]
        > need to query this every time the mouse moves and don't know the event[/color]
        that[color=blue]
        > fires when the mouse is not over my form.
        > Thanks,
        > ~Logan
        >
        > "Rafael J. Pellicer" <rafaelpp@cantv .net> wrote in message
        > news:%23SjD4yMf DHA.3228@tk2msf tngp13.phx.gbl. ..[color=green]
        > >
        > > With API: GetCursorPos Lib "user32" Alias "GetCursorP os" (lpPoint As
        > > POINTAPI) As Long
        > >
        > >
        > >
        > >
        > > "Logan Mckinley" <logan@globalwe b.net> escribió en el mensaje
        > > news:eNMX5kMfDH A.1872@TK2MSFTN GP09.phx.gbl...[color=darkred]
        > > > I need to be able to detect mouse movement even when it is not over my
        > > > application. I can get the mouse cords using MousePosition but I am[/color][/color][/color]
        not[color=blue][color=green][color=darkred]
        > > > sure if there is an event that hits my program when the mouse is not[/color][/color]
        > over[color=green]
        > > my[color=darkred]
        > > > program.
        > > > One idea i had was make a child form that was transparent and use the
        > > > MouseMove event to keep that transparent window under the mouse but[/color][/color][/color]
        the[color=blue][color=green][color=darkred]
        > > > transparent window did not catch the MouseMove event.
        > > > I also tried putting a timer on the form that checks MousePosition but[/color][/color]
        > to[color=green][color=darkred]
        > > > make it smooth i would have to check it so often that it is to[/color][/color][/color]
        processor[color=blue][color=green][color=darkred]
        > > > intensive.
        > > >
        > > > Any help is appriciated,
        > > > Thanks in advance,
        > > > ~Logan
        > > >
        > > >[/color]
        > >
        > >[/color]
        >
        >[/color]


        Comment

        Working...