Jump to content

Belli Bir Alanda Mouse Tıklaması


bmozdemir
 Share

Recommended Posts

Herkese kolay gelsin.

Mesela belli bir koordinatlar içerisinde fare'ye tıklandığında ESC tuşuna basılmasını nasıl ayarlayabilirim.
Örnek resimdeki dikdörtgenin içinde herhangi bir yere tıklandığında esc tuşuna basılması istiyorum fakat bu ben programı kapatana katar hep ektif olmasınıda sağlamam gerekiyor.
Yardımlarınız için şimdiden teşekkürler.

[img]http://e1210.hizliresim.com/12/6/dq16k.jpg[/img]
Link to comment
Share on other sites

kodu incele
[CODE]
#include <guiconstants.au3>
Opt("MouseCoordMode", 0)
$Main = GUICreate("deneme", 500, 500)
$MyLabel = GUICtrlCreateLabel("buraya tıkla", 10, 20, 100, 25)
GUISetState()
While 1
$imsg = GUIGetMsg()
Select
Case $imsg = -3
Exit
Case _LabelClicked($Main, $MyLabel)
MsgBox(48, "bilgi", "doğru yere tıkladınız!")
EndSelect
WEnd
Func _LabelClicked($sg_GUI, $sl_Label, $s_hexKey = '01', $st_Text = '', $v_dll = 'user32.dll')
Local $Opt = Opt('MouseCoordMode', 2)
Local $a_R = DllCall($v_dll, "int", "GetAsyncKeyState", "int", '0x' & $s_hexKey)
If Not @Error And BitAND($a_R[0], 0x8000) = 0x8000 Then
Local $lab_Pos = ControlGetPos($sg_GUI, $st_Text, $sl_Label)
Local $lab_Mouse = MouseGetPos()
Opt('MouseCoordMode', $Opt)
If IsArray($lab_Mouse) And IsArray($lab_Pos) Then
If $lab_Mouse[0] >= $lab_Pos[0] And $lab_Mouse[0] <= $lab_Pos[0] + $lab_Pos[2] And $lab_Mouse[1] >= $lab_Pos[1] _
And $lab_Mouse[1] <= $lab_Pos[1] + $lab_Pos[3] Then Return 1
EndIf
EndIf
Return 0
EndFunc
[/CODE]

Link to comment
Share on other sites

İlginize çok teşekkür ederim aradığım kodu buldum.
Belki işine yarayan olur diye buraya ekliyorum.
İyi günler.

[quote]
[CODE]

#include "MouseOnEvent.au3"

HotKeySet("{ESC}", "_Quit")

Global $iLimit_Coord_Left = 0
Global $iLimit_Coord_Top = 20
Global $iLimit_Coord_Width = 1500
Global $iLimit_Coord_Height = 25

;This will disable primary down event, double clicks included (see next)
_MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT, "_MousePrimaryDown_Event", 0, -1)

;Enable Double click, comment next line if double clicks should be disabled
_MouseSetOnEvent($MOUSE_PRIMARYDBLCLK_EVENT, "_MousePrimaryDown_Event", 0, -1)

While 1
Sleep(100)
WEnd

Func _MousePrimaryDown_Event()
Local $aMPos = MouseGetPos()

If ($aMPos[0] >= $iLimit_Coord_Left And $aMPos[0] <= $iLimit_Coord_Left + $iLimit_Coord_Width) And _
($aMPos[1] >= $iLimit_Coord_Top And $aMPos[1] <= $iLimit_Coord_Top + $iLimit_Coord_Height) Then Return 1 ;Block mouse click
Return 0
EndFunc

Func _Quit()
Exit
EndFunc
[/CODE]
[/quote]

Edited by bmozdemir
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...