#include <GUIMenu.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
$hWindow = WinGetHandle('[ACTIVE]')
$hEnable = _WinEnable($hWindow, False)
Sleep(5000)
_WinEnable($hWindow, $hEnable)
Func _WinEnable($hWnd, $bEnable = True)
If $bEnable Then
GUIDelete($bEnable)
EndIf
$hMenu = _GUICtrlMenu_GetMenu($hWnd)
$iItems = _GUICtrlMenu_GetItemCount($hMenu)
For $i = 0 To $iItems - 1
_GUICtrlMenu_EnableMenuItem($hMenu, $i, ($bEnable ? 0 : 2))
Next
If $bEnable Then
Return
EndIf
Local $aWinPos = WinGetPos($hWnd)
Local $aWinCSize = WinGetClientSize($hWnd)
Local $hGUI = GUICreate('', $aWinCSize[0], $aWinCSize[1], 0, 0, $WS_POPUP, -1, $hWnd)
_WinAPI_SetParent($hGUI, $hWnd)
WinSetTrans($hGUI, '', 254)
GUISetState(@SW_DISABLE, $hGUI)
GUISetState(@SW_SHOWNOACTIVATE, $hGUI)
Return $hGUI
EndFunc