Код:
#NoTrayIcon
#Include <GDIPlus.au3>
#Include <GUIConstantsEx.au3>
#Include <Icons.au3>
#Include <WinAPIEx.au3>
#Include <WindowsConstants.au3>
_GDIPlus_Startup()
$hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\3.jpg')
$Width = _GDIPlus_ImageGetWidth($hImage)
$Height = _GDIPlus_ImageGetHeight($hImage)
; Увеличиваем/уменьшаем пропорционально
$W = @DesktopWidth
$H = $Height * $W / $Width
If $H < @DesktopHeight Then
$H = @DesktopHeight
$W = $Width * $H / $Height
EndIf
; Растягиваем и обрезаем до размеров экрана картинку
$hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
$hFit = _Icons_Bitmap_Resize($hBitmap, $W, $H)
$hCrop = _Icons_Bitmap_Crop($hFit, ($W - @DesktopWidth) / 2, ($H - @DesktopHeight) / 2, @DesktopWidth, @DesktopHeight)
_WinAPI_DeleteObject($hBitmap)
_WinAPI_DeleteObject($hFit)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_Shutdown()
; $hParent нужен для того, что бы не появлялась иконка в области задач и по Alt-Tab
$hParent = GUICreate('', 0, 0, 0, 0, 0, $WS_EX_TOOLWINDOW)
$hForm = GUICreate('', @DesktopWidth, @DesktopHeight, 0, 0, BitOR($WS_DISABLED, $WS_POPUPWINDOW), BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST), $hParent)
GUISetState()
For $i = 0 To 255 Step 5
_SetBitmap($hForm, $hCrop, $i)
Sleep(5)
Next
Sleep(1000)
GUIDelete()
Func _SetBitmap($hWnd, $hBitmap, $iOpacity)
Local $hDC, $hMemDC, $hSv, $pBlend, $tBlend, $pSize, $tSize, $pSource, $tSource
$hDC = _WinAPI_GetDC($hWnd)
$hMemDC = _WinAPI_CreateCompatibleDC($hDC)
$hSv = _WinAPI_SelectObject($hMemDC, $hBitmap)
$tSize = _WinAPI_GetBitmapDimension($hBitmap)
$pSize = DllStructGetPtr($tSize)
$tSource = DllStructCreate($tagPOINT)
$pSource = DllStructGetPtr($tSource)
$tBlend = DllStructCreate($tagBLENDFUNCTION)
$pBlend = DllStructGetPtr($tBlend)
DllStructSetData($tBlend, 'Alpha', $iOpacity)
DllStructSetData($tBlend, 'Format', 1)
_WinAPI_UpdateLayeredWindow($hWnd, $hDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)
_WinAPI_ReleaseDC($hWnd, $hDC)
_WinAPI_SelectObject($hMemDC, $hSv)
_WinAPI_DeleteDC($hMemDC)
EndFunc ;==>_SetBitmap