Jump to content

Basic Graphic Color Pixel Mouse Position


newsak2005
 Share

Recommended Posts

#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

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