Hello. I am looking for some help. I was wondering if any of you are familiar with AutoIt Script coding. If so, any help is appreciated. I wrote this code to help me, but it does not seem to work for me. I am also wondering if you could help me spot what I am doing wrong and how I can fix it. Or point me to another place to learn how to fix it.
Thanks.
CODE
#include <WinAPI.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Const $WM_MOUSEFIRST = 0x0200
Const $WM_LBUTTONDOWN = 0x0201
Const $WM_LBUTTONDBLCLK = 0x0203
Const $WM_RBUTTONDOWN = 0x0204
Const $WM_RBUTTONUP = 0x0205
Const $WM_RBUTTONDBLCLK = 0x0206
Const $WM_MBUTTONDOWN = 0x0207
Const $WM_MBUTTONUP = 0x0208
Const $WM_MBUTTONDBLCLK = 0x0209
Const $WM_MOUSEWHEEL = 0x020A
Const $WM_MOUSELAST = 0x020A
Local $hmod
$LowLevelMouseProc = DllCallbackRegister("_LowLevelMouseProc", "long", "int;wparam;lparam")
$hmod = _WinAPI_GetModuleHandle(0)
$hHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, DllCallbackGetPtr($LowLevelMouseProc), $hmod)
$Form2 = GUICreate("Form2", 320, 298, 303, 219)
$Label1 = GUICtrlCreateLabel("", 17, 17, 100, 100)
GUICtrlSetBkColor(-1, 0xA6CAF0)
$Label2 = GUICtrlCreateLabel("", 200, 17, 100, 100)
GUICtrlSetBkColor(-1, 0xFF0000)
$Label3 = GUICtrlCreateLabel("", 17, 150, 100, 100)
GUICtrlSetBkColor(-1, 0x008080)
$Label4 = GUICtrlCreateLabel("", 200, 150, 100, 100)
GUICtrlSetBkColor(-1, 0x000000)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func _LowLevelMouseProc($nCode, $wParam, $lParam)
If $nCode < 0 Then
Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam)
EndIf
Select
Case $wParam = $WM_LBUTTONDOWN
$pos = MouseGetPos()
$var = PixelGetColor( $pos[0] , $pos[1] )
Select
Case $var = 0xA6CAF0
ToolTip("MouseClick ==> 0xA6CAF0", $pos[0] , $pos[1])
Case $var = 0xFF0000
ToolTip("MouseClick ==> 0xFF0000", $pos[0] , $pos[1])
EndSelect
Case $wParam = $WM_LBUTTONUP
$pos = MouseGetPos()
$var = PixelGetColor( $pos[0] , $pos[1] )
Select
Case $var = 0x008080
ToolTip("MouseClick ==> 0x008080", $pos[0] , $pos[1])
Case $var = 0x000000
ToolTip("MouseClick ==> 0x000000", $pos[0] , $pos[1])
EndSelect
Case $wParam = $WM_MOUSEMOVE
Case $wParam = $WM_MOUSEWHEEL
Case $wParam = $WM_RBUTTONDOWN
Case $wParam = $WM_RBUTTONUP
EndSelect
Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam)
EndFunc
Func OnAutoItExit()
_WinAPI_UnhookWindowsHookEx($hHook)
DllCallbackFree($LowLevelMouseProc)
EndFunc