Jump to content

generate 2 boxes


joeyone
 Share

Recommended Posts

This code generates 1 green rectangle

I want to have 2 rectangles and also make different settings to each of them like position and size

what should i change in the code to have this possible?

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


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

GUISetBkColor(0x00FF00)

_GUICreateInvRect($gui, 3, 3, 120, 57)

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
Link to comment
Share on other sites

#include<GUICONSTANTS.AU3>

$box1=GUICreate('',50,50,200,200, $WS_POPUP, bitor($WS_EX_TOPMOST,$WS_EX_TOOLWINDOW))

GUISetBkColor(0xff0000)

$box2=GUICreate('',50,50,260,200, $WS_POPUP, bitor($WS_EX_TOPMOST,$WS_EX_TOOLWINDOW))

GUISetBkColor(0xff0000)

GUISetState(@SW_SHOW,$box1)

GUISetState(@SW_SHOW,$box2)

WHILE 1

SLEEP(100)

WEnd(@SW_SHOW,$box2)

Edited by Aceguy
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...