#NoTrayIcon
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_UseX64=n
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiButton.au3>
#include <GDIPlus.au3>
#include <Sound.au3>
#include <wmp.au3>
#include <GuiAVI.au3>
Global $IconInfo[5][5]
Global $hGUI, $bg, $hGraphic2, $hGraphic, $Bgbitmap, $a
Global $Width = 800, $Height = 600
_GDIPlus_Startup()
$a = 1
$hGUI = GUICreate("CrossDoor", $Width, $Height, -1, -1, $WS_POPUP, $WS_EX_LAYERED)
$cmdMini = GUICtrlCreateButton("", 708, -2, 28, 20)
GUICtrlSetTip(-1, "最小化窗口")
$cmdMax = GUICtrlCreateButton("", 735, -2, 28, 20)
GUICtrlSetTip(-1, "最大化窗口")
$cmdClose = GUICtrlCreateButton("", 762, -2, 39, 20)
GUICtrlSetTip(-1, "关闭窗口")
$zuo = GUICtrlCreateButton("", 200, 550, 40, 40)
$you = GUICtrlCreateButton("", 550, 550, 40, 40)
Global $Buttoninfo[5] = [GUICtrlGetHandle($cmdMini), GUICtrlGetHandle($cmdMax), GUICtrlGetHandle($cmdClose), GUICtrlGetHandle($zuo), GUICtrlGetHandle($you)]
IconInfo_Loading()
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")
show()
GUISetState()
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
_WinAPI_DeleteObject($Bgbitmap)
_GDIPlus_GraphicsDispose($hGraphic2)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam)
Local Const $BCN_HOTITEMCHANGE = -1249
Local $tNMBHOTITEM = DllStructCreate("hwnd hWndFrom;int IDFrom;int Code;dword dwFlags", $lParam)
Local $nNotifyCode = DllStructGetData($tNMBHOTITEM, "Code")
Local $nID = DllStructGetData($tNMBHOTITEM, "IDFrom")
Local $hCtrl = DllStructGetData($tNMBHOTITEM, "hWndFrom")
Local $dwFlags = DllStructGetData($tNMBHOTITEM, "dwFlags")
Switch $nNotifyCode
Case $BCN_HOTITEMCHANGE; Win XP 支持
If BitAND($dwFlags, 0x10) = 0x10 Then
FlashCtl($hCtrl, True)
ElseIf BitAND($dwFlags, 0x20) = 0x20 Then
FlashCtl($hCtrl, False)
EndIf
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY
Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
Dim $iIDFrom = BitAND($iwParam, 0xFFFF)
Dim $iCode = BitShift($iwParam, 16)
Switch $iIDFrom
Case $cmdMini
If $iCode = $BN_CLICKED Then WinSetState($hWnd, "", @SW_MINIMIZE)
Case $cmdMax
If $iCode = $BN_CLICKED Then WinSetState($hWnd, "", @SW_MAXIMIZE)
Case $cmdClose
If $iCode = $BN_CLICKED Then Exit
Case $you
If $iCode = $BN_CLICKED And $a < 4 Then
$a = $a + 1
MsgBox(0, "", $a, 0.3)
show()
Else
MsgBox(0, "", "已经是最后一张了,不要再点了哦")
EndIf
Case $zuo
If $iCode = $BN_CLICKED And $a > 1 Then
$a = $a - 1
MsgBox(0, "", $a, 0.3)
show()
EndIf
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_COMMAND
Func FlashCtl($hControl, $iFlag)
_GDIPlus_GraphicsClear($hGraphic2, 0x00FFFFFF)
_GDIPlus_GraphicsDrawImageRect($hGraphic2, $bg, 0, 0, $Width, $Height)
For $i = 0 To UBound($Buttoninfo) - 1
$trect = _WinAPI_GetWindowRect($Buttoninfo[$i])
$x = DllStructGetData($trect, "left")
$y = DllStructGetData($trect, "top")
$w = DllStructGetData($trect, "right") - DllStructGetData($trect, "left")
$h = DllStructGetData($trect, "Bottom") - DllStructGetData($trect, "top")
$trect = _WinAPI_GetWindowRect($hGUI)
$x = $x - DllStructGetData($trect, "left")
$y = $y - DllStructGetData($trect, "top")
If $iFlag And $hControl = $Buttoninfo[$i] Then
_GDIPlus_GraphicsDrawImageRect($hGraphic2, $IconInfo[$i][1], $x, $y, $w, $h)
Else
_GDIPlus_GraphicsDrawImageRect($hGraphic2, $IconInfo[$i][0], $x, $y, $w, $h)
EndIf
Next
SetBitmap($hGUI, $Bgbitmap)
Sleep(30)
EndFunc ;==>FlashCtl
Func SetBitmap($hGUI, $hImage, $iOpacity = 255)
Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend
$hScrDC = _WinAPI_GetDC(0)
$hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)
$hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
$hOld = _WinAPI_SelectObject($hMemDC, $hBitmap)
$tSize = DllStructCreate($tagSIZE)
$pSize = DllStructGetPtr($tSize)
DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage))
DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage))
$tSource = DllStructCreate($tagPOINT)
$pSource = DllStructGetPtr($tSource)
$tBlend = DllStructCreate($tagBLENDFUNCTION)
$pBlend = DllStructGetPtr($tBlend)
DllStructSetData($tBlend, "Alpha", $iOpacity)
DllStructSetData($tBlend, "Format", 1)
_WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)
_WinAPI_SelectObject($hMemDC, $hOld)
_WinAPI_ReleaseDC(0, $hScrDC)
_WinAPI_DeleteDC($hMemDC)
_WinAPI_DeleteObject($hBitmap)
EndFunc ;==>SetBitmap
Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam)
Switch $hWnd
Case $hGUI
Switch $iMsg
Case $WM_NCHITTEST
Return $HTCAPTION
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NCHITTEST
Func _API_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $isColorRef = False)
Local Const $AC_SRC_ALPHA = 1
Local Const $ULW_ALPHA = 2
Local Const $LWA_ALPHA = 0x2
Local Const $LWA_COLORKEY = 0x1
If Not $isColorRef Then
$i_transcolor = Hex(String($i_transcolor), 6)
$i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
EndIf
Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $LWA_COLORKEY + $LWA_ALPHA)
If @error Then
Return SetError(@error, 0, 0)
ElseIf $Ret[0] = 0 Then
Return SetError(4, 0, 0)
Else
Return 1
EndIf
EndFunc ;==>_API_SetLayeredWindowAttributes
Func show()
$bg = _GDIPlus_ImageLoadFromFile(@ScriptDir & "" & $a & ".jpg")
$hGraphic = _GDIPlus_ImageGetGraphicsContext($bg)
$Bgbitmap = _GDIPlus_BitmapCreateFromGraphics($Width, $Height, $hGraphic)
$hGraphic2 = _GDIPlus_ImageGetGraphicsContext($Bgbitmap)
_GDIPlus_GraphicsDrawImageRect($hGraphic2, $bg, 0, 0, $Width, $Height)
SetBitmap($hGUI, $Bgbitmap)
EndFunc ;==>show
Func IconInfo_Loading()
$IconInfo[0][0] = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\btn_mini_highlight.png")
$IconInfo[0][1] = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\btn_mini_down.png")
$IconInfo[0][2] = False
$IconInfo[1][0] = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\btn_max_highlight.png")
$IconInfo[1][1] = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\btn_max_down.png")
$IconInfo[1][2] = False
$IconInfo[2][0] = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\btn_close_highlight.png")
$IconInfo[2][1] = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\btn_close_down.png")
$IconInfo[2][2] = False
$IconInfo[3][0] = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\1.png")
$IconInfo[3][1] = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\2.png")
$IconInfo[3][2] = False
$IconInfo[4][0] = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\3.png")
$IconInfo[4][1] = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\4.png")
$IconInfo[4][2] = False
EndFunc ;==>IconInfo_Loading