Try this:
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $hGUI, $iX_Min = 0, $iX_Max = @DesktopWidth - 500, $iY_Min = 0, $iY_Max = @DesktopHeight - 500
Global $ViewerVideo
_Main()
Func _Main()
$hGUI = GUICreate("Test", 500, 500)
$Tab = GUICtrlCreateTab(16, 16, 450, 450)
$ViewerVideo = GUICreate("K Muzik Viewer Video", 250, 250, 20, 50, $WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_DISABLED, $WS_EX_MDICHILD), $hGUI)
GUISetBkColor(0x00000, $ViewerVideo)
WinSetTrans($ViewerVideo, "", 220)
GUISetState(@SW_SHOWNOACTIVATE, $ViewerVideo)
GUISetState(@SW_SHOW, $hGUI)
GUIRegisterMsg($WM_WINDOWPOSCHANGING, "WM_WINDOWPOSCHANGING")
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
EndFunc ;==>_Main
Func WM_WINDOWPOSCHANGING($hWnd, $Msg, $wParam, $lParam)
If $hWnd = $hGUI Then
Local $stWinPos = DllStructCreate("uint;uint;int;int;int;int;uint", $lParam)
Local $iLeft = DllStructGetData($stWinPos, 3)
Local $iTop = DllStructGetData($stWinPos, 4)
Local $iWidth = DllStructGetData($stWinPos, 5)
Local $iHeight = DllStructGetData($stWinPos, 6)
If $iLeft < $iX_Min Then DllStructSetData($stWinPos, 3, $iX_Min)
If $iTop < $iY_Min Then DllStructSetData($stWinPos, 4, $iY_Min)
If $iLeft > $iX_Max Then DllStructSetData($stWinPos, 3, $iX_Max)
If $iTop > $iY_Max Then DllStructSetData($stWinPos, 4, $iY_Max)
EndIf
EndFunc ;==>WM_WINDOWPOSCHANGING
JS