GaryFrost Posted June 13, 2005 Share Posted June 13, 2005 #include <GuiConstants.au3> $my_gui = GUICreate("MyGUI", 392, 323) _GuiHole($my_gui, 80, 30, 200) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;; EndSelect WEnd Exit Func _GuiHole($h_win, $i_x, $i_y, $i_size) Dim $pos, $outer_rgn, $inner_rgn, $wh, $combined_rgn, $ret $pos = WinGetPos($h_win) $outer_rgn = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", $pos[2], "long", $pos[3]) If IsArray($outer_rgn) Then $inner_rgn = DllCall("gdi32.dll", "long", "CreateEllipticRgn", "long", $i_x, "long", $i_y, "long", $i_x + $i_size, "long", $i_y + $i_size) If IsArray($inner_rgn) Then $combined_rgn = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 0, "long", 0) If IsArray($combined_rgn) Then DllCall("gdi32.dll", "long", "CombineRgn", "long", $combined_rgn[0], "long", $outer_rgn[0], "long", $inner_rgn[0], "int", 4) $ret = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $combined_rgn[0], "int", 1) If $ret[0] Then Return 1 Else Return 0 EndIf Else Return 0 EndIf Else Return 0 EndIf Else Return 0 EndIf EndFunc ;==>_GuiHole SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
ryeguy Posted June 13, 2005 Share Posted June 13, 2005 Hmm thats freaky. Link to comment Share on other sites More sharing options...
GaryFrost Posted June 13, 2005 Author Share Posted June 13, 2005 Size the width and height seperatly #include <GuiConstants.au3> $my_gui = GUICreate("MyGUI", 392, 323) _GuiHole($my_gui, 80, 30, 200, 300) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;; EndSelect WEnd Exit Func _GuiHole($h_win, $i_x, $i_y, $i_sizew, $i_sizeh) Dim $pos, $outer_rgn, $inner_rgn, $wh, $combined_rgn, $ret $pos = WinGetPos($h_win) $outer_rgn = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", $pos[2], "long", $pos[3]) If IsArray($outer_rgn) Then $inner_rgn = DllCall("gdi32.dll", "long", "CreateEllipticRgn", "long", $i_x, "long", $i_y, "long", $i_x + $i_sizew, "long", $i_y + $i_sizeh) If IsArray($inner_rgn) Then $combined_rgn = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 0, "long", 0) If IsArray($combined_rgn) Then DllCall("gdi32.dll", "long", "CombineRgn", "long", $combined_rgn[0], "long", $outer_rgn[0], "long", $inner_rgn[0], "int", 4) $ret = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $combined_rgn[0], "int", 1) If $ret[0] Then Return 1 Else Return 0 EndIf Else Return 0 EndIf Else Return 0 EndIf Else Return 0 EndIf EndFunc ;==>_GuiHole SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
busysignal Posted June 14, 2005 Share Posted June 14, 2005 Some really interesting effects. Cheers.. Link to comment Share on other sites More sharing options...
w0uter Posted June 14, 2005 Share Posted June 14, 2005 nice, would this mean we could use custom shape GUI's? like in some keygens for ex. My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
erifash Posted June 14, 2005 Share Posted June 14, 2005 I have made my own function that is greatly based off of yours but instead of cutting off everything except a rectangle you specify (left, top, width, height) it will make the rectangle invisible. Basically it trims off the rectangle instead of everything around it. Except it has a problem. You can't call the function more than once, for some reason it will erase the previous rectangle. Help? expandcollapse popup#include <GUIConstants.au3> $gui = GUICreate("GUI", 500, 500) _GUICreateInvRect($gui, 100, 150, 200, 200) GUISetState() While 1 If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit Sleep(10) Wend Func _GUICreateInvRect($hwnd, $l, $t, $w, $h) $pos = WinGetPos($hwnd) $1 = 0 $2 = 0 $3 = $pos[2] $4 = $t $ret = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $1, "long", $2, "long", $3, "long", $4) $1 = 0 $2 = 0 $3 = $l $4 = $pos[3] $ret2 = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $1, "long", $2, "long", $3, "long", $4) $1 = $l + $w $2 = 0 $3 = $pos[2] $4 = $pos[3] $ret3 = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $1, "long", $2, "long", $3, "long", $4) $1 = 0 $2 = $t + $h $3 = $pos[2] $4 = $pos[3] $ret4 = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $1, "long", $2, "long", $3, "long", $4) DllCall("gdi32.dll", "long", "CombineRgn", "long", $ret[0], "long", $ret[0], "long", $ret2[0], "int", 2) DllCall("gdi32.dll", "long", "CombineRgn", "long", $ret[0], "long", $ret[0], "long", $ret3[0], "int", 2) DllCall("gdi32.dll", "long", "CombineRgn", "long", $ret[0], "long", $ret[0], "long", $ret4[0], "int", 2) DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hwnd, "long", $ret[0], "int", 1) EndFunc It seems like the problem is in the "CombineRgn" part. It doesn't combine the other rectangle into itself. My UDFs:_FilePrint() | _ProcessGetName() | _Degree() and _Radian()My Scripts:Drive Lock - Computer Lock Using a Flash DriveAU3Chat - Simple Multiuser TCP ChatroomStringChunk - Split a String Into Equal PartsAutoProxy - Custom Webserver Link to comment Share on other sites More sharing options...
Josbe Posted June 14, 2005 Share Posted June 14, 2005 nice, would this mean we could use custom shape GUI's?like in some keygens for ex.<{POST_SNAPBACK}>Yes, we can...using CreatePolygonRgn function. (gdi32.dll) AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta Link to comment Share on other sites More sharing options...
zeroZshadow Posted June 14, 2005 Share Posted June 14, 2005 ...i asked this question in the support before, why didn't anyone helped me there i feel supressed but where can i find more about this CreatePolygonRgn ?? *If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip... Link to comment Share on other sites More sharing options...
layer Posted June 14, 2005 Share Posted June 14, 2005 MSDN FootbaG Link to comment Share on other sites More sharing options...
GaryFrost Posted June 15, 2005 Author Share Posted June 15, 2005 (edited) I have made my own function that is greatly based off of yours but instead of cutting off everything except a rectangle you specify (left, top, width, height) it will make the rectangle invisible. Basically it trims off the rectangle instead of everything around it. Except it has a problem. You can't call the function more than once, for some reason it will erase the previous rectangle. Help? expandcollapse popup#include <GUIConstants.au3> $gui = GUICreate("GUI", 500, 500) _GUICreateInvRect($gui, 100, 150, 200, 200) GUISetState() While 1 If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit Sleep(10) Wend Func _GUICreateInvRect($hwnd, $l, $t, $w, $h) $pos = WinGetPos($hwnd) $1 = 0 $2 = 0 $3 = $pos[2] $4 = $t $ret = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $1, "long", $2, "long", $3, "long", $4) $1 = 0 $2 = 0 $3 = $l $4 = $pos[3] $ret2 = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $1, "long", $2, "long", $3, "long", $4) $1 = $l + $w $2 = 0 $3 = $pos[2] $4 = $pos[3] $ret3 = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $1, "long", $2, "long", $3, "long", $4) $1 = 0 $2 = $t + $h $3 = $pos[2] $4 = $pos[3] $ret4 = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $1, "long", $2, "long", $3, "long", $4) DllCall("gdi32.dll", "long", "CombineRgn", "long", $ret[0], "long", $ret[0], "long", $ret2[0], "int", 2) DllCall("gdi32.dll", "long", "CombineRgn", "long", $ret[0], "long", $ret[0], "long", $ret3[0], "int", 2) DllCall("gdi32.dll", "long", "CombineRgn", "long", $ret[0], "long", $ret[0], "long", $ret4[0], "int", 2) DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hwnd, "long", $ret[0], "int", 1) EndFuncIt seems like the problem is in the "CombineRgn" part. It doesn't combine the other rectangle into itself.<{POST_SNAPBACK}>If understand you correctly, your wanting to cut out more that one rectangle, correct?If so, then your correct, you'll have to do it all at one time and combine the regions.Take a look at the following thread:http://www.autoitscript.com/forum/index.php?showtopic=12476 Edited June 15, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
DaLiMan Posted June 15, 2005 Share Posted June 15, 2005 Yes, we can...using CreatePolygonRgn function. (gdi32.dll) <{POST_SNAPBACK}>After reading this I thought I'd give it a shot but....pfffff....only errors here!! Can anyone tell me I am going in the right direction?I altered the original script from gafrost but I have no VB or DLL experiance whatsoever so I have figure it out somehow.Have looked at MSDN for some info.Well here it is. (dont laugh) #include <GuiConstants.au3> $my_gui = GUICreate(" SkinIt", 300, 300) $button = GUICtrlCreateButton("Exit", 35, 10) _MyForm2($my_gui) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $button ExitLoop Case Else ;;; EndSelect WEnd Exit Func _MyForm2($h_win) Dim $ret, $ret2, $ret3, $ret4 $ret = DllCall("gdi32.dll", "long", "CreatePolygonRgn", "long",150, "long", 150, "long", 250, "long", 200, "long", 100, "long", 200, "int",3 ,"int", "alternate") $ret5 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $ret[0], "int", 1) EndFunc Link to comment Share on other sites More sharing options...
GaryFrost Posted June 15, 2005 Author Share Posted June 15, 2005 Looking at MSDN for CreatePolygonRgn you'll need to use DllStruct functions CreatePolygonRgn only takes 3 params, 1st is an array of points, 2nd number of points in the array, and 3rd fill mode SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
DaLiMan Posted June 15, 2005 Share Posted June 15, 2005 Looking at MSDN for CreatePolygonRgn you'll need to use DllStruct functionsCreatePolygonRgn only takes 3 params, 1st is an array of points, 2nd number of points in the array, and 3rd fill mode<{POST_SNAPBACK}>eehhh....OK.....After playing with it for a while (and only getting errors) I would like to ask for some assistance.Like I said, I have no VB experiance whatsoever and I'm trying to find out how these functions work.I tried to make an triangle-GUI and maybe go from there but I'm not even close.Anyway here's my effort for this afternoon:(Probably doesn't make any sense..)Func _MyForm2($h_win) Dim $ret, $ret2 Dim $str = "int;int;int;int;int;int" Dim $a = DllStructCreate($str) Dim $v1="150,150" Dim $v2="250,200" Dim $v3="100,200" DllStructSetData($a,1,$v1) DllStructSetData($a,2,$v2) DllStructSetData($a,3,$v3) $create = DllStructGetData($a,1) + DllStructGetData($a,2) + DllStructGetData($a,3) $ret = DllCall("gdi32.dll", "long", "CreatePolygonRgn", "int", $create, "int",3 ,"int", "alternate") $ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $ret, "int", 1) EndFuncPS: Downloaded the latest BETA now for the DLLstruct function too. Link to comment Share on other sites More sharing options...
upnorth Posted June 15, 2005 Share Posted June 15, 2005 (edited) I tried CreatePolygonRgn a few weeks ago. Still has some bugs...like its at the wrong coordinates.expandcollapse popup#include<gdi32.au3> $dc = _GetDC( 0) $dll = DllOpen( "Gdi32.dll") Dim $my_array [4] [3] $my_array [0] [0] = 3 $my_array [1] [1] = 436;lx1 $my_array [1] [2] = 35;ry2 $my_array [2] [1] = 78;ly1 $my_array [2] [2] = 430;bx3 $my_array [3] [1] = 706;rx2 $my_array [3] [2] = 456;by3 $r = _CreatePolygonRgn( $my_array, $ALTERNATE, $dll) $g = _CreateSolidBrush( 0x00ff00, $dll) HotKeySet( "{ESC}", "quit") While 1 _FillRgn($dc, $r, $g) Sleep(20) WEnd Func _GetDC( $hwnd, $dll_h = "user32.dll") $return = DllCall( $dll_h, "ptr", "GetDC", "hwnd", $hwnd) Return $return[0] EndFunc Func _ReleaseDC( $hwnd, $dc, $dll_h = "user32.dll") $return = DllCall( $dll_h, "int", "ReleaseDC", "hwnd", $hwnd, "ptr", $dc) Return $return[0] EndFunc Func quit() DllClose( $dll) _ReleaseDC( 0, $dc) Exit EndFuncgdi32.au3Fixed link. Edited June 18, 2005 by UP NORTH 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