Jump to content

Custom Shpae Gui Function Problem


Recommended Posts

try this

#include <GUIConstants.au3>

$GUI = GUICreate("test",300,300,-1,-1,$WS_POPUP)
GUISetBkColor(0xFFFFFF)

; CreatePolyRgn takes an array of points...
; the following goes from
;     0,0 to
;     600,500 to
;     500,800 to
;     100,500 to
;     0,0

$a = CreatePolyRgn("0,0,600,500,500,800,100,500,0,0")
SetWindowRgn($GUI,$a)

$Eggzit = GUICtrlCreateButton("Bye",80,170,60,25)

GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $Eggzit Or $msg = $GUI_EVENT_CLOSE Then Exit
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)
    $lppt = 0
    Return $ret[0]
EndFunc

8)

NEWHeader1.png

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...