Sign in to follow this  
Followers 0
newsak2005

Basic Graphic Color Pixel Mouse Position

1 post in this topic

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>

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

$hWnd = GUICreate("Form", 111, 40, 192, 124, _
BitOR($WS_MINIMIZEBOX,$WS_SYSMENU,$WS_POPUP,$WS_GROUP,$WS_CLIPSIBLINGS))
WinSetOnTop("Form", "", 1)
$hGraphic = GUICtrlCreateGraphic(0, 0, 108, 35)
$hLabel = GUICtrlCreateLabel("Label1", 27, 29, 60, 17)

GUISetState(@SW_SHOW)

Do
    $iX = _WinAPI_GetMousePosX()
    $iY = _WinAPI_GetMousePosY()
    $iC = PixelGetColor($iX, $iY, $hWnd)
    GUICtrlSetBkColor($hGraphic, $iC)
    GUICtrlSetData($hLabel, '0x'&Hex($iC, 6))
    _WinAPI_MoveWindow($hWnd, $iX+15, $iY+15, 100, 50, True)
Sleep(100)
Until GUIGetMsg() = -3
GUIDelete($hWnd)

Func Terminate()
    Exit 0
EndFunc

Share this post


Link to post
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
Sign in to follow this  
Followers 0