Jump to content

make 2 gui boxes


joeyone
 Share

Recommended Posts

i have a script that generates one green box

the problem is that i want to insert one more box in my script so i

have two boxes that i can put out on the screen

here is the script hope someone can help me to create one more in the script thank you!

here is my code

#include <GUIConstants.au3>
HotKeySet("{ESC}", "_end")


$gui = GUICreate("GUI", 30, 30, 15, 15, $WS_POPUP, $WS_EX_TOPMOST)

GUISetBkColor(0x00FF00)

_GUICreateInvRect($gui, 5, 5, 20, 20)

GUISetState()

While 1
    WinMove($gui, "", 20, 20)
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;==>_GUICreateInvRect


Func _end()
    Exit(0)
EndFunc
Edited by joeyone
Link to comment
Share on other sites

i have a script that generates one green box

the problem is that i want to insert one more box in my script so i

have two boxes that i can put out on the screen

here is the script hope someone can help me to create one more in the script thank you!

here is my code

#include <GUIConstants.au3>
HotKeySet("{ESC}", "_end")


$gui = GUICreate("GUI", 30, 30, 15, 15, $WS_POPUP, $WS_EX_TOPMOST)

GUISetBkColor(0x00FF00)

_GUICreateInvRect($gui, 5, 5, 20, 20)

GUISetState()

While 1
    WinMove($gui, "", 20, 20)
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;==>_GUICreateInvRect


Func _end()
    Exit(0)
EndFunc
did you try creating both gui and then use:

GUISetState(@SW_SHOW,$gui1)
GUISetState(@SW_SHOW,$gui2)
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...