bmozdemir Posted October 6, 2012 Share Posted October 6, 2012 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] Quote Link to comment Share on other sites More sharing options...
mesale0077 Posted October 6, 2012 Share Posted October 6, 2012 form üzerindemi yani guı içindeki alanmı yoksa masaüstünde seçtiğin alanmı onu tam belirtmemişsin yoksa aktif olan programın üzerindeki alanmı? ayrıca örnek kodun varsa düzenleme yapabilirim Quote Link to comment Share on other sites More sharing options...
mesale0077 Posted October 6, 2012 Share Posted October 6, 2012 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] Quote Link to comment Share on other sites More sharing options...
bmozdemir Posted October 6, 2012 Author Share Posted October 6, 2012 (edited) İ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 October 6, 2012 by bmozdemir Quote Link to comment Share on other sites More sharing options...
mesale0077 Posted October 8, 2012 Share Posted October 8, 2012 (edited) mantık aynı ben sadecede guı üzerindeki alan için düşünmüştüm. Edited October 16, 2012 by mesale0077 Quote Link to comment Share on other sites More sharing options...
bmozdemir Posted October 16, 2012 Author Share Posted October 16, 2012 evet aslında mantık aynı ama bana lazım olan o bölgeyi yasaklamak olduğu için bu kod gerekiyordu neyseki buşdum ilginize teşekkür ederim. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.