Jump to content

Right-mouse-problem


Recommended Posts

  • Moderators

Hello there,

I need to catch right-click event.If I click at some button, I want to report, that I clicked it by right mouse button. Is it possible? :o/ I tried but withount success! :mellow:

I will be glad for any way to solve it, thank U.... :)

Download Beta Here: http://www.autoitscript.com/forum/index.php?showtopic=19717

Look at _IsPressed() in the Beta Help File:

_IsPressed('02') would be what your looking for, '02' being the right mouse button.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Download Beta Here: http://www.autoitscript.com/forum/index.php?showtopic=19717

Look at _IsPressed() in the Beta Help File:

_IsPressed('02') would be what your looking for, '02' being the right mouse button.

Thank U, SmOke_N, I got it! :)

It's only an example program. It may be usefull for creating of simple games..

#include <Misc.au3>
#Include <GUIConstants.au3>

$left=0
$top=-20
;                number of buttons in matrix
$matrix_x=3   ;<= column 
$matrix_y=3   ;<= line
;;;;

$max=$matrix_y*$matrix_x
Dim $btn[$max]


GUICreate("My GUI-R/L mouse",200,150,400,400) 
Autoitsetoption("MouseCoordMode",0)

for $i=0 to ($matrix_x*$matrix_y-1) 
  if (Mod($i,$matrix_x)=0) then
    $top=$top+20
    $left=0
  endif
  $btn[$i]=GUICtrlCreateButton ( "", $left, $top,20,20)
  $left=$left+20
next

GUISetState (@SW_SHOW)
$number=0

$dll = DllOpen("user32.dll")
while 1
  $msg=guigetmsg()

  if $msg=-3 then 
    DllClose($dll) 
    exit
  endif

  If _IsPressed("02", $dll) then
    $position_mouse=MouseGetPos ()
    $test=40
    $number_y=1

    while 1 
       if ($position_mouse[1]<$test) then
        $number_x=Floor(($position_mouse[0])/20)+1
        exitloop
       endif
       $test+=20
       $number_y+=1   
    wend
  GUICtrlSetdata((($number_y-1)*$matrix_x + $number_x+2),"R") ; -3 because $msg=3 ==> first button

  endif
  if ($msg>=$btn[0]) then GUICtrlSetdata($msg,"L")
WEnd
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...