Send mouse clic

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

    #1

    Send mouse clic

    Hello,
    I cant find a way to send a "mouse clic" (right or left) to an application,
    like SENDKEYS for the keyboard.
    Thanks for any answer


  • StoneWare

    #2
    Re: Send mouse clic


    "Totoche" <nivu@niconnu.c om> skrev i en meddelelse
    news:e59lst$d9m $1@news.tiscali .fr...[color=blue]
    > Hello,
    > I cant find a way to send a "mouse clic" (right or left) to an
    > application, like SENDKEYS for the keyboard.
    > Thanks for any answer[/color]

    Use the Form_MouseDown routine...like this

    Private Sub Form_MouseDown( Button As Integer, Shift As Integer, X As Single,
    Y As Single)
    If Button = 1 Then MsgBox "left"
    If Button = 2 Then MsgBox "right"
    End Sub


    Comment

    • Totoche

      #3
      Re: Send mouse clic

      Many thanks for your fast answer.
      But... i can't do it working...( excuse me i am french and new programmer)
      Could you be more explicit ??
      What i did:

      Sub Activatetest()
      returnvalue = Shell(App.Path + "\test.exe" , 1)
      AppActivate returnvalue
      SendKeys "{RIGHT}", True
      SendKeys "{RIGHT}", True
      test = Form_MouseDown (1,0,10,10)
      End Sub

      Private Sub Form_MouseDown( Button As Integer, Shift As Integer, X As Single,
      Y As Single)
      If Button = 1 Then MsgBox "left"
      If Button = 2 Then MsgBox "right"
      End Sub

      The sendkeys are executed, but the mouse clic do not work (error at
      execution time).
      Many thanks for your help


      "StoneWare" <HejMedDig@NoSp am.Net> a écrit dans le message de news:
      4478617a$0$2752 7$edfadb0f@drea d11.news.tele.d k...[color=blue]
      >
      > "Totoche" <nivu@niconnu.c om> skrev i en meddelelse
      > news:e59lst$d9m $1@news.tiscali .fr...[color=green]
      >> Hello,
      >> I cant find a way to send a "mouse clic" (right or left) to an
      >> application, like SENDKEYS for the keyboard.
      >> Thanks for any answer[/color]
      >
      > Use the Form_MouseDown routine...like this
      >
      > Private Sub Form_MouseDown( Button As Integer, Shift As Integer, X As
      > Single, Y As Single)
      > If Button = 1 Then MsgBox "left"
      > If Button = 2 Then MsgBox "right"
      > End Sub
      >
      >[/color]


      Comment

      • Karl E. Peterson

        #4
        Re: Send mouse clic

        Totoche wrote:[color=blue]
        > Hello,
        > I cant find a way to send a "mouse clic" (right or left) to an
        > application, like SENDKEYS for the keyboard.[/color]

        You're looking for the mouse_event API. It doesn't actually send mouse
        events to a specific application, but rather to a location on screen. Take
        a look at http://vb.mvps.org/samples/MouseEvent for a drop-in ready class to
        help you get going.
        --


        Comment

        • Totoche

          #5
          Re: Send mouse clic

          Many thanks Karl.
          Regards

          "Karl E. Peterson" <karl@mvps.or g> a écrit dans le message de news:
          e5iek5$vd0$1@nn tp.aioe.org...[color=blue]
          > Totoche wrote:[color=green]
          >> Hello,
          >> I cant find a way to send a "mouse clic" (right or left) to an
          >> application, like SENDKEYS for the keyboard.[/color]
          >
          > You're looking for the mouse_event API. It doesn't actually send mouse
          > events to a specific application, but rather to a location on screen.
          > Take
          > a look at http://vb.mvps.org/samples/MouseEvent for a drop-in ready class
          > to
          > help you get going.
          > --
          >
          >[/color]


          Comment

          Working...