函数参考


_WinAPI_DrawAnimatedRects

动画窗口的标题,显示图标或窗口的最小化或最大化.

#Include <WinAPIEx.au3>
_WinAPI_DrawAnimatedRects ( $hWnd, $tRectFrom, $tRectTo )

参数

$hWnd Handle to the window whose caption should be animated on the screen.
$tRectFrom $tagRECT 结构, 指定图标或最小化窗口的大小和位置.
$tRectTo $tagRECT 结构, 指定恢复窗口的位置和大小.

返回值

成功: 返回 1.
失败: 返回 0,并设置@error标志为非 0 值.

注意/说明

窗口标题将从 $tRectFrom 指定的位置动画显示到 $tRectTo 指定的位置.
 其效果类似于窗口最小化或最大化.

相关

详情参考

在MSDN中搜索


示例/演示


#NoTrayIcon

#Include <APIConstants.au3>
#include <GUIConstantsEx.au3>
#Include <WinAPIEx.au3>

Opt('MustDeclareVars', 1)
Opt('TrayMenuMode', 1)

Global $hTray = ControlGetHandle('[CLASS:Shell_TrayWnd]', '', 'TrayNotifyWnd1')
Global $hForm, $Msg, $Dummy, $TrayRestoreItem, $TrayExitItem

$TrayRestoreItem = TrayCreateItem('Restore')
TrayItemSetState(-1, $TRAY_DEFAULT)
TrayCreateItem('')
$TrayExitItem = TrayCreateItem('Exit')
TraySetClick(8)

$hForm = GUICreate('My GUI')
$Dummy = GUICtrlCreateDummy()
GUIRegisterMsg($WM_SYSCOMMAND, 'WM_SYSCOMMAND')
GUISetState()

While 1
    $Msg = TrayGetMsg()
    Switch $Msg
        Case $TrayRestoreItem
            _WinAPI_DrawAnimatedRects($hForm, _WinAPI_GetWindowRect($hTray), _WinAPI_GetWindowRect($hForm))
            GUISetState(@SW_SHOW, $hForm)
            TraySetState(2)
        Case $TrayExitItem
            ExitLoop
    EndSwitch
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            _WinAPI_AnimateWindow($hForm, BitOR($AW_BLEND, $AW_HIDE))
            ExitLoop
        Case $Dummy ; Minimize
            _WinAPI_DrawAnimatedRects($hForm, _WinAPI_GetWindowRect($hForm), _WinAPI_GetWindowRect($hTray))
            GUISetState(@SW_HIDE, $hForm)
            TraySetState(1)
    EndSwitch
WEnd

Func WM_SYSCOMMAND($hWnd, $iMsg, $wParam, $lParam)
    Switch $hWnd
        Case $hForm
            Switch $wParam
                Case $SC_MINIMIZE
                    GUICtrlSendToDummy($Dummy)
                    Return 0
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_SYSCOMMAND