Paulie Posted July 24, 2006 Posted July 24, 2006 (edited) Just another random Semi-Unfinished scrap made with Larry's custom shape Functions -V3- expandcollapse popup#include <GUIConstants.au3> #include <RoundGUI.au3> Dim $loc, $loc1, $locA, $locB $GUI = GUICreate("Left",400,400,0,0, $WS_POPUP, BitOr($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) GUISetBkColor(0x000000) $a = CreateRoundRectRgn(50,50,100,200,300,300) $b = CreateRoundRectRgn(66.5,75,66,150,300,300) $c = CreateRoundRectRgn(150,50,100,200,300,300) $d = CreateRoundRectRgn(166.5,75,66,150,300,300) $GUI2 = GUICreate("Right",400,400,0,0,$WS_POPUP, BitOr($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) GUISetBkColor(0x000000) $Gui3 = GUICreate("Eye 1",20,20,100,125,$WS_POPUP, BitOr($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) GUISetBkColor(0x000000) $Gui4 = GUICreate("Eye 2",20,20,200,125,$WS_POPUP, BitOr($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) GUISetBkColor(0x000000) CombineRgn($a,$B) CombineRgn($c,$d) SetWindowRgn($GUI,$a) SetWindowRgn($GUI2,$c) ;$b = CreatePolyRgn("39,250,458,250,250,500") ;CombineRgn($a,$cool.gif ;SetWindowRgn($GUI,$a) RoundGUI($GUI3, 1,1,20,20) RoundGUI($GUI4, 1,1,20,20) GUISetState(@SW_SHOW,$GUI) GUISetState(@SW_SHOW,$GUI2) GUISetState(@SW_SHOW,$GUI3) GUISetState(@SW_SHOW,$GUI4) While 1 $msg = GUIGetMsg() $pos = MouseGetPos() $GUIPos1= WinGetPos("Eye 1") $GUIPos2= WinGetPos("Eye 2") If $msg = $GUI_EVENT_CLOSE Then Exit If $loc <> $Pos[0] Or $loc1 <> $Pos[1] Then $loc = "" If $pos[0] > $GUIPos1[0] And $GuiPos1[0] < 100 then $loc = $GuiPos1[0]+2 ElseIf $pos[0] < $GUIPos1[0] And $GUIPos1[0] > 75 Then $loc = $GuiPos1[0]-2 Else $loc = $GuiPos1[0] EndIf $loc1 = "" If $pos[1] > $GUIPos1[1] And $GuiPos1[1] < 190 then $loc1 = $GuiPos1[1]+2 ElseIf $pos[1] < $GUIPos1[1] And $GUIPos1[1] > 95 Then $loc1 = $GuiPos1[1]-2 Else $loc1 = $GuiPos1[1] EndIf WinMove("Eye 1", "", $loc, $loc1) EndIf ;---------------------- If $locA < $Pos[0]-2 Or $locA > $Pos[0]+2 Or $locB <> $Pos[1] Then $locA = "" If $pos[0] > $GUIPos2[0] And $GuiPos2[0] < 200 then $locA = $GuiPos2[0]+2 ElseIf $pos[0] < $GUIPos2[0] And $GUIPos2[0] > 175 Then $locA = $GuiPos2[0]-2 Else $locA = $GuiPos2[0] EndIf $locB = "" If $pos[1] > $GUIPos2[1] And $GuiPos2[1] < 190 then $locB = $GuiPos2[1]+2 ElseIf $pos[1] < $GUIPos2[1] And $GUIPos2[1] > 95 Then $locB = $GuiPos2[1]-2 Else $locB = $GuiPos2[1] EndIf WinMove("Eye 2", "", $locA, $locB) EndIf Sleep(50) WEnd Func SetWindowRgn($h_win, $rgn) DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $rgn, "int", 1) EndFunc Func CreatePolyRgn($pt) Local $ALTERNATE = 1 Local $buffer = "" $pt = StringSplit($pt,",") For $i = 1 to $pt[0] $buffer = $buffer & "int;" Next $buffer = StringTrimRight($buffer,1) $lppt = DllStructCreate($buffer) For $i = 1 to $pt[0] DllStructSetData($lppt,$i,$pt[$i]) Next $ret = DllCall("gdi32.dll","long","CreatePolygonRgn","ptr",DllStructGetPtr($lppt),"int",Int($pt[0] / 2),"int",$ALTERNATE) ;DllStructDelete($lppt) Return $ret[0] 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", "ExtSelectClipRgn", "long", $rgn1, "long", $rgn1, "long", $rgn2, "int", 2);ORIGINAL LARRY DllCall("gdi32.dll", "long", "CombineRgn", "long", $rgn1, "long", $rgn1, "long", $rgn2, "int", 3) EndFunc If anyone has any way to smoothe the movement out, and maybe make the eyes round instead of squares I'd be REALLY appreciative Edit: and also figure out a way to make it not make windows in the taskbar Edited July 24, 2006 by Paulie
jvanegmond Posted July 24, 2006 Posted July 24, 2006 In the helpfile there is a good example on how to place a .gif file on a window. This can help you make it round. I haven't looked at your script yet, but i will do so later. github.com/jvanegmond
Paulie Posted July 24, 2006 Author Posted July 24, 2006 In the helpfile there is a good example on how to place a .gif file on a window. This can help you make it round. I haven't looked at your script yet, but i will do so later.Well, i have a UDF that was made by gafrost(I think Correct me if I'm wrong), the problem, is I have to define coordinates to make it round, which i don't understand, and which could become overly complicated since the window's moving Heres the Round UDF: Func RoundGUI($h_win, $i_x1, $i_y1, $i_x3, $i_y3) Dim $pos, $ret, $ret2 $pos = WinGetPos($h_win) $ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $pos[2], "long", $pos[3], "long", $i_x3, "long", $i_y3) If $ret[0] Then $ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $ret[0], "int", 1) If $ret2[0] Then Return 1 Else Return 0 EndIf Else Return 0 EndIf EndFunc ;==>RoundGUI And i don't know how to make the moving smoother, cause now it moves all the way down, then all the way over as opposed to going diagonally
Paulie Posted July 24, 2006 Author Posted July 24, 2006 (edited) Okay, finished version 2 (See first post)got rounded eyes and got rid of the taskbar windows, now all i need is to smooth the movementAny ideas?Edit:Note: You need to put the "RoundGUI()" function above in the include file for it to work Edited July 24, 2006 by Paulie
Valuater Posted July 24, 2006 Posted July 24, 2006 (edited) heres an effort expandcollapse popup#include <GUIConstants.au3> ;#include <RoundGUI.au3> Dim $loc, $loc1, $locA, $locB $GUI = GUICreate("Left",400,400,0,0, $WS_POPUP, BitOr($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) GUISetBkColor(0x000000) $a = CreateRoundRectRgn(50,50,100,200,300,300) $b = CreateRoundRectRgn(66.5,75,66,150,300,300) $c = CreateRoundRectRgn(150,50,100,200,300,300) $d = CreateRoundRectRgn(166.5,75,66,150,300,300) $GUI2 = GUICreate("Right",400,400,0,0,$WS_POPUP, BitOr($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) GUISetBkColor(0x000000) $Gui3 = GUICreate("Eye 1",20,20,100,125,$WS_POPUP, BitOr($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) GUISetBkColor(0x000000) $Gui4 = GUICreate("Eye 2",20,20,200,125,$WS_POPUP, BitOr($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) GUISetBkColor(0x000000) CombineRgn($a,$b) CombineRgn($c,$d) SetWindowRgn($GUI,$a) SetWindowRgn($GUI2,$c) ;$b = CreatePolyRgn("39,250,458,250,250,500") ;CombineRgn($a,$cool.gif ;SetWindowRgn($GUI,$a) RoundGUI($GUI3, 1,1,20,20) RoundGUI($GUI4, 1,1,20,20) GUISetState(@SW_SHOW,$GUI) GUISetState(@SW_SHOW,$GUI2) GUISetState(@SW_SHOW,$GUI3) GUISetState(@SW_SHOW,$GUI4) While 1 $msg = GUIGetMsg() $pos = MouseGetPos() $GUIPos1= WinGetPos("Eye 1") $GUIPos2= WinGetPos("Eye 2") If $msg = $GUI_EVENT_CLOSE Then Exit If $loc <> $Pos[0] Or $loc1 <> $Pos[1] Then $loc = "" If $pos[0] > $GUIPos1[0] And $GuiPos1[0] < 100 then $loc = $GuiPos1[0]+1 ElseIf $pos[0] < $GUIPos1[0] And $GUIPos1[0] > 75 Then $loc = $GuiPos1[0]-1 Else $loc = $GuiPos1[0] EndIf $loc1 = "" If $pos[1] > $GUIPos1[1] And $GuiPos1[1] < 190 then $loc1 = $GuiPos1[1]+2 ElseIf $pos[1] < $GUIPos1[1] And $GUIPos1[1] > 95 Then $loc1 = $GuiPos1[1]-2 Else $loc1 = $GuiPos1[1] EndIf WinMove("Eye 1", "", $loc, $loc1) EndIf ;---------------------- If $locA < $Pos[0]-1 Or $locA > $Pos[0]+1 Or $locB <> $Pos[1] Then $locA = "" If $pos[0] > $GUIPos2[0] And $GuiPos2[0] < 200 then $locA = $GuiPos2[0]+1 ElseIf $pos[0] < $GUIPos2[0] And $GUIPos2[0] > 175 Then $locA = $GuiPos2[0]-1 Else $locA = $GuiPos2[0] EndIf $locB = "" If $pos[1] > $GUIPos2[1] And $GuiPos2[1] < 190 then $locB = $GuiPos2[1]+2 ElseIf $pos[1] < $GUIPos2[1] And $GUIPos2[1] > 95 Then $locB = $GuiPos2[1]-2 Else $locB = $GuiPos2[1] EndIf WinMove("Eye 2", "", $locA, $locB) EndIf Sleep(50) WEnd Func SetWindowRgn($h_win, $rgn) DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $rgn, "int", 1) EndFunc Func CreatePolyRgn($pt) Local $ALTERNATE = 1 Local $buffer = "" $pt = StringSplit($pt,",") For $i = 1 to $pt[0] $buffer = $buffer & "int;" Next $buffer = StringTrimRight($buffer,1) $lppt = DllStructCreate($buffer) For $i = 1 to $pt[0] DllStructSetData($lppt,$i,$pt[$i]) Next $ret = DllCall("gdi32.dll","long","CreatePolygonRgn","ptr",DllStructGetPtr($lppt),"int",Int($pt[0] / 2),"int",$ALTERNATE) ;DllStructDelete($lppt) Return $ret[0] 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", "ExtSelectClipRgn", "long", $rgn1, "long", $rgn1, "long", $rgn2, "int", 2);ORIGINAL LARRY DllCall("gdi32.dll", "long", "CombineRgn", "long", $rgn1, "long", $rgn1, "long", $rgn2, "int", 3) EndFunc Func RoundGUI($h_win, $i_x1, $i_y1, $i_x3, $i_y3) Dim $pos, $ret, $ret2 $pos = WinGetPos($h_win) $ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $pos[2], "long", $pos[3], "long", $i_x3, "long", $i_y3) If $ret[0] Then $ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $ret[0], "int", 1) If $ret2[0] Then Return 1 Else Return 0 EndIf Else Return 0 EndIf EndFunc ;==>_GuiRoundCorners 8) Edited July 24, 2006 by Valuater
Paulie Posted July 24, 2006 Author Posted July 24, 2006 (edited) Thats GREAT val It's a little slow... But it's still Plenty to be worth calling V3 Thanks Man Edit (updated first post) Edited July 24, 2006 by Paulie
ivan Posted July 24, 2006 Posted July 24, 2006 Wow guys, impressive shapes. I am trying to get a boobs shape to illustrate region definition and combination. I'll share it when I'm done, It'll make a few kids laugh, for sure. IVAN Think out of the boxGrabber: Yet another WinInfo tool_CSVLib (still alpha)Dynamic html in au3
Moderators SmOke_N Posted July 24, 2006 Moderators Posted July 24, 2006 Thats GREAT valIt's a little slow... But it's still Plenty to be worth calling V3Thanks ManEdit(updated first post)If you change the Sleep(50) to Sleep(10) in the While/WEnd loop it's a bit faster. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Paulie Posted July 24, 2006 Author Posted July 24, 2006 If you change the Sleep(50) to Sleep(10) in the While/WEnd loop it's a bit faster.LOL thanks smokeI missed that, i personally like it at 15-20 but thats just me
GaryFrost Posted July 25, 2006 Posted July 25, 2006 expandcollapse popup#include <GUIConstants.au3> ;#include <RoundGUI.au3> Dim $loc, $loc1, $locA, $locB $GUI = GUICreate("Left", 400, 400, 0, 0, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) GUISetBkColor(0x000000) $a = CreateRoundRectRgn(50, 50, 100, 200, 300, 300) $b = CreateRoundRectRgn(66.5, 75, 66, 150, 300, 300) $c = CreateRoundRectRgn(150, 50, 100, 200, 300, 300) $d = CreateRoundRectRgn(166.5, 75, 66, 150, 300, 300) $GUI2 = GUICreate("Right", 400, 400, 0, 0, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) GUISetBkColor(0x000000) $Gui3 = GUICreate("Eye 1", 20, 20, 100, 125, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) GUISetBkColor(0x000000) $Gui4 = GUICreate("Eye 2", 20, 20, 200, 125, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) GUISetBkColor(0x000000) CombineRgn($a, $B) CombineRgn($c, $d) SetWindowRgn($GUI, $a) SetWindowRgn($GUI2, $c) ;$b = CreatePolyRgn("39,250,458,250,250,500") ;CombineRgn($a,$cool.gif ;SetWindowRgn($GUI,$a) RoundGUI($Gui3, 1, 1, 20, 20) RoundGUI($Gui4, 1, 1, 20, 20) GUISetState(@SW_SHOW, $GUI) GUISetState(@SW_SHOW, $GUI2) GUISetState(@SW_SHOW, $Gui3) GUISetState(@SW_SHOW, $Gui4) While 1 $msg = GUIGetMsg() $pos = MouseGetPos() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $loc <> $pos[0] Or $loc1 <> $pos[1] _SetLeftEye($Gui3, $loc, $loc1, $pos) _SetRightEye($Gui4, $locA, $locB, $pos) EndSelect WEnd Func _SetLeftEye($Gui3, $loc, $loc1, $pos) $GUIPos1 = WinGetPos("Eye 1") $loc = "" If $pos[0] > $GUIPos1[0] And $GUIPos1[0] < 100 Then $loc = $GUIPos1[0] + 1 ElseIf $pos[0] < $GUIPos1[0] And $GUIPos1[0] > 75 Then $loc = $GUIPos1[0] - 1 Else $loc = $GUIPos1[0] EndIf $loc1 = "" If $pos[1] > $GUIPos1[1] And $GUIPos1[1] < 190 Then $loc1 = $GUIPos1[1] + 2 ElseIf $pos[1] < $GUIPos1[1] And $GUIPos1[1] > 95 Then $loc1 = $GUIPos1[1] - 2 Else $loc1 = $GUIPos1[1] EndIf WinMove("Eye 1", "", $loc, $loc1) EndFunc ;==> _SetLeftEye Func _SetRightEye ($Gui4, $locA, $locB, $pos) $GUIPos2 = WinGetPos("Eye 2") $locA = "" If $pos[0] > $GUIPos2[0] And $GUIPos2[0] < 200 Then $locA = $GUIPos2[0] + 1 ElseIf $pos[0] < $GUIPos2[0] And $GUIPos2[0] > 175 Then $locA = $GUIPos2[0] - 1 Else $locA = $GUIPos2[0] EndIf $locB = "" If $pos[1] > $GUIPos2[1] And $GUIPos2[1] < 190 Then $locB = $GUIPos2[1] + 2 ElseIf $pos[1] < $GUIPos2[1] And $GUIPos2[1] > 95 Then $locB = $GUIPos2[1] - 2 Else $locB = $GUIPos2[1] EndIf WinMove("Eye 2", "", $locA, $locB) EndFunc ;==> _SetRightEye Func SetWindowRgn($h_win, $rgn) DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $rgn, "int", 1) EndFunc ;==>SetWindowRgn Func CreatePolyRgn($pt) Local $ALTERNATE = 1 Local $buffer = "" $pt = StringSplit($pt, ",") For $i = 1 To $pt[0] $buffer = $buffer & "int;" Next $buffer = StringTrimRight($buffer, 1) $lppt = DllStructCreate($buffer) For $i = 1 To $pt[0] DllStructSetData($lppt, $i, $pt[$i]) Next $ret = DllCall("gdi32.dll", "long", "CreatePolygonRgn", "ptr", DllStructGetPtr($lppt), "int", Int($pt[0] / 2), "int", $ALTERNATE) ;DllStructDelete($lppt) Return $ret[0] EndFunc ;==>CreatePolyRgn 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 ;==>CreateRoundRectRgn Func CombineRgn(ByRef $rgn1, ByRef $rgn2) ;DllCall("gdi32.dll", "long", "ExtSelectClipRgn", "long", $rgn1, "long", $rgn1, "long", $rgn2, "int", 2);ORIGINAL LARRY DllCall("gdi32.dll", "long", "CombineRgn", "long", $rgn1, "long", $rgn1, "long", $rgn2, "int", 3) EndFunc ;==>CombineRgn Func RoundGUI($h_win, $i_x1, $i_y1, $i_x3, $i_y3) Dim $pos, $ret, $ret2 $pos = WinGetPos($h_win) $ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $pos[2], "long", $pos[3], "long", $i_x3, "long", $i_y3) If $ret[0] Then $ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $ret[0], "int", 1) If $ret2[0] Then Return 1 Else Return 0 EndIf Else Return 0 EndIf EndFunc ;==>RoundGUI SciTE for AutoItDirections for Submitting Standard UDFs  Don't argue with an idiot; people watching may not be able to tell the difference. Â
Moderators SmOke_N Posted July 25, 2006 Moderators Posted July 25, 2006 As usual, nice one Gary. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Valuater Posted July 25, 2006 Posted July 25, 2006 (edited) Mine was shorter, but i got "jumping" eye balls at certain points the reason i tried to do this If $locA < $Pos[0]-1 Or $locA > $Pos[0]+1 Or $locB <> $Pos[1] Then was to try to stop the jumping... i didn't get to finish it.. had to go yours jumps to gafrost anyone else have this problem? 8) Edited July 25, 2006 by Valuater
dandymcgee Posted August 18, 2006 Posted August 18, 2006 @Valuater Yeah, with both of them I get "jumping" eyes if i move the mouse up/down real quick. Dunno, what's causing it, but anyways sweet scripts guys. Keep up the GREAT work. - Dan [Website]
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