- Offizieller Beitrag
Hi,
ich weiß nicht, inwiefern dies bereits bekannt ist. Evtl. kann es ja jemand gebrauchen.
Spoiler anzeigen
#include <GuiConstants.au3>
[/autoit] [autoit][/autoit] [autoit]$my_gui = GUICreate("MyGUI", 392, 323)
[/autoit] [autoit][/autoit] [autoit]_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
hier mal ein kleines Bsp was man damit so machen kann:
Spoiler anzeigen
#include <GUIConstants.au3>
HotKeySet("{ESC}", "_end")
Global $start = MouseGetPos()
[/autoit] [autoit][/autoit] [autoit]$gui = GUICreate("GUI", 30, 30, $start[0] - 15, $start[1] - 15, $WS_POPUP, $WS_EX_TOPMOST)
GUISetBkColor(0x00FF00)
_GUICreateInvRect($gui, 5, 5, 20, 20)
GUISetState()
While 1
Sleep(10)
$now = MouseGetPos()
WinMove($gui, "", $now[0] - 15, $now[1] - 15)
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
So long,
Mega