KevinO Posted December 12, 2014 Share Posted December 12, 2014 hello there i want to draw a box like the picture so it will for example detect the Blue Pixel (PixelSearch) and draw a box on it the box is a .GIF file or GDI depends on whats easier is this possible? and how need it to be done? Link to comment Share on other sites More sharing options...
Solution KevinO Posted December 12, 2014 Author Solution Share Posted December 12, 2014 (edited) i found this code, but now i want it to follow a moving pixel on my screen expandcollapse popup#include <GUIConstants.au3> HotKeySet("{ESC}","bye") $GUI = GUICreate("",30,30,-1,-1,$WS_POPUP,$WS_EX_TOPMOST) GUISetBkColor(0xFF0000) $a = CreateRoundRectRgn(0,0,30,30,30,30) $b = CreateRoundRectRgn(4,4,22,22,26,26) CombineRgn($a,$B) SetWindowRgn($GUI,$a) GUISetState() GUISetState(@SW_DISABLE) While 1 Sleep(50) $pt = MouseGetPos() If Not @error Then WinMove($GUI,"",$pt[0] - 15,$pt[1] - 15) WEnd Func SetWindowRgn($h_win, $rgn) DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $rgn, "int", 1) EndFunc Func CreateRoundRectRgn($l, $t, $w, $h, $e1, $e2) $ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $l, "long", $t, "long", $l + $w, "long", $t + $h, "long", $e1, "long", $e2) Return $ret[0] EndFunc Func CombineRgn(ByRef $rgn1, ByRef $rgn2) DllCall("gdi32.dll", "long", "CombineRgn", "long", $rgn1, "long", $rgn1, "long", $rgn2, "int", 3) EndFunc Func bye() Exit EndFunc EDIT: Found it working code is expandcollapse popup#include <GUIConstants.au3> HotKeySet("{ESC}","bye") $GUI = GUICreate("",30,30,-1,-1,$WS_POPUP,$WS_EX_TOPMOST) GUISetBkColor(0xFF0000) $a = CreateRoundRectRgn(0,0,30,30,30,30) $b = CreateRoundRectRgn(4,4,22,22,26,26) CombineRgn($a,$B) SetWindowRgn($GUI,$a) GUISetState() GUISetState(@SW_DISABLE) While 1 Sleep(50) $coord = PixelSearch( 0, 0, @DesktopWidth, @DesktopHeight,0xD8FFCF) If Not @error Then WinMove($GUI,"",$coord[0] - 15, $coord[1] - 15) WEnd Func SetWindowRgn($h_win, $rgn) DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $rgn, "int", 1) EndFunc Func CreateRoundRectRgn($l, $t, $w, $h, $e1, $e2) $ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $l, "long", $t, "long", $l + $w, "long", $t + $h, "long", $e1, "long", $e2) Return $ret[0] EndFunc Func CombineRgn(ByRef $rgn1, ByRef $rgn2) DllCall("gdi32.dll", "long", "CombineRgn", "long", $rgn1, "long", $rgn1, "long", $rgn2, "int", 3) EndFunc Func bye() Exit EndFunc This is solved Edited December 12, 2014 by KevinO Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now