School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 300,454 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,603 people online right now. Registration is fast and FREE... Join Now!




AutoIt Script Help With Color

 

AutoIt Script Help With Color

bruntale

3 Jun, 2009 - 03:24 PM
Post #1

New D.I.C Head
*

Joined: 3 Jun, 2009
Posts: 1

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


User is offlineProfile CardPM
+Quote Post


bsaunders

RE: AutoIt Script Help With Color

4 Jun, 2009 - 03:54 AM
Post #2

D.I.C Addict
****

Joined: 18 Jan, 2009
Posts: 554



Thanked: 42 times
My Contributions
What is the problem?
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/8/09 01:57AM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month