Jump to content

_WinAPI_Mouse_Event help?


Recommended Posts

Do I put a .dll thing the script for this to work inside of quake?

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Opt("PixelCoordMode", 2)
$winhandle = GUICreate("Win", 493, 220, 227, 202)
$LabelX1 = GUICtrlCreateLabel("LabelX1", 16, 8, 153, 50)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$LabelX2 = GUICtrlCreateLabel("LabelX2", 16, 65, 153, 50)
GUICtrlSetBkColor(-1, 0xFF0000)
$LabelX3 = GUICtrlCreateLabel("LabelX3", 16, 122, 153, 50)
GUICtrlSetBkColor(-1, 0x008000)

$Label1 = GUICtrlCreateLabel("", 180, 16, 200, 22)
$Label2 = GUICtrlCreateLabel("", 180, 48, 200, 22)
GUISetState(@SW_SHOW)


Do
$CursorInfo = GUIGetCursorInfo($winhandle)
if IsArray($CursorInfo) Then
GUICtrlSetData($Label1,"Mouse X coord \ Mouse left ===> " & $CursorInfo[0])
GUICtrlSetData($Label2,"Mouse Y coord \ Mouse top ====> " & $CursorInfo[1])
EndIf
$bool = Searching_Mouse(16, 8, 153, 50,0xFFFFFF,$winhandle) ; ===> 0xFFFFFF Searching pos LabelX1 ("LabelX1", 16, 8, 153, 50)
if $bool = True Then MsgBox(0,"Mouse in LabelX1","OK")
Until GUIGetMsg() = $GUI_EVENT_CLOSE

Func Searching_Mouse($left ,$top,$width,$height ,$colour , $win_handle)
$CursorInfo = GUIGetCursorInfo($win_handle)
if IsArray($CursorInfo) Then
if $CursorInfo[0] >= $left And $CursorInfo[0] <= ($left + $width ) _
And $CursorInfo[1] >= $top And $CursorInfo[1] <= ($top + $height) Then 
$Pixe = PixelGetColor($left,$top)
$Hex = Hex($Pixe, 6)
$RGB1 = '0x' & StringMid($Hex, 5, 2) & StringMid($Hex, 3, 2) & StringMid($Hex, 1, 2)
$Hex = Hex($colour, 6)
$RGB2 = '0x' & StringMid($Hex, 5, 2) & StringMid($Hex, 3, 2) & StringMid($Hex, 1, 2)
MsgBox(0,"", "RGB1 => " & $RGB1 & "      RGB2 => " & $RGB2)
IF $RGB1 = $RGB2 Then 
Return True
Else
Return False
EndIf
EndIf
EndIf
EndFunc
Edited by wolf9228

صرح السماء كان هنا

 

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...