joeyone Posted October 15, 2009 Posted October 15, 2009 (edited) hi it was i while ago i done something in autoit, for a year ago or so and when i now decided to install the program again and look at my old script that rendering a box i cant get it to work. In the old script it worked perfectly but not nowadays the errors i get is: Variable used without being declared. $gui: possibly used before declaration. this is my code hope someone can help me correct this error thanks in advance expandcollapse popuphori() verti() Func hori() _GUICreateInvRect($gui, 3, 3, 124, 61) EndFunc ;Vertikalt läge Func verti() _GUICreateInvRect($gui, 3, 3, 61, 124) EndFunc Global $WS_POPUP Global $WS_EX_TOPMOST Global $WS_EX_DLGMODALFRAME ;Inställningar rektangel $gui = GUICreate("GUI", 67, 130, 100, 100, $WS_POPUP, $WS_EX_TOPMOST) GUISetBkColor(0x48FF00) _GUICreateInvRect($gui, 3, 3, 61, 124) GUISetState() Opt("GUIOnEventMode", 1) ; Change to OnEvent mode $mainwindow = GUICreate(" Bejeweled 2 Control", 160, 365, 100, 300, $WS_EX_DLGMODALFRAME) GuiCtrlCreateLabel("", 42, 288, 78, 40) GuiCtrlSetBkColor(-1, 0x00FF00) 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 Edited October 15, 2009 by joeyone
Moderators Melba23 Posted October 15, 2009 Moderators Posted October 15, 2009 joeyone, Quite a few changes since you last coded. Without knowing quite what you were expecting to get, I think this is fairly close: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> Opt("GUIOnEventMode", 1) ; Change to OnEvent mode ;Inställningar rektangel $gui = GUICreate("GUI", 67, 130, 100, 100, $WS_POPUP, $WS_EX_TOPMOST) GUISetBkColor(0x48FF00) _GUICreateInvRect($gui, 3, 3, 61, 124) GUISetState() $mainwindow = GUICreate(" Bejeweled 2 Control", 160, 365, 100, 300, $WS_EX_DLGMODALFRAME) GuiCtrlCreateLabel("", 42, 288, 78, 40) GuiCtrlSetBkColor(-1, 0x00FF00) GUISetState() hori() verti() While 1 Sleep(10) WEnd Func hori() _GUICreateInvRect($gui, 3, 3, 124, 61) EndFunc ;Vertikalt läge Func verti() _GUICreateInvRect($gui, 3, 3, 61, 124) EndFunc Func _GUICreateInvRect($hwnd, $l, $t, $w, $h) $pos = WinGetPos($hwnd) $1 = 0 $2 = 0 $3 = $pos[2] $4 = $t $ret = _WinAPI_CreateRectRgn($1, $2, $3, $4) $1 = 0 $2 = 0 $3 = $l $4 = $pos[3] $ret2 = _WinAPI_CreateRectRgn($1, $2, $3, $4) $1 = $l + $w $2 = 0 $3 = $pos[2] $4 = $pos[3] $ret3 = _WinAPI_CreateRectRgn($1, $2, $3, $4) $1 = 0 $2 = $t + $h $3 = $pos[2] $4 = $pos[3] $ret4 = _WinAPI_CreateRectRgn($1, $2, $3, $4) _WinAPI_CombineRgn($ret, $ret, $ret2, 2) _WinAPI_CombineRgn($ret, $ret, $ret3, 2) _WinAPI_CombineRgn($ret, $ret, $ret4, 2) _WinAPI_SetWindowRgn($hwnd, $ret) EndFunc M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
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