我使用
a snippet from AutoIt's forums
(如果你没有,我会先去那里寻求支持)。它工作得很好。有几个小问题,但没有什么是在个案基础上无法解决的。试试看!
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
_GDIPlus_Startup()
$hSplashlogo = _GDIPlus_ImageLoadFromFile("C:\Program Files (x86)\AutoIt3\Examples\GUI\Torus.png")
$logoheight = (@DesktopHeight/2) - (_GDIPlus_ImageGetHeight($hSplashlogo)/2) - 50
$logowidth = (@DesktopWidth /2) - (_GDIPlus_ImageGetWidth($hSplashlogo)/2)
$SplashGUIlogo = GUICreate("", _GDIPlus_ImageGetWidth($hSplashlogo), _GDIPlus_ImageGetHeight($hSplashlogo), $logowidth, $logoheight, $WS_POPUP, BitOR($WS_EX_LAYERED,$WS_EX_TOOLWINDOW))
_SetBitmap($SplashGUIlogo, $hSplashlogo, 255, _GDIPlus_ImageGetWidth($hSplashlogo), _GDIPlus_ImageGetHeight($hSplashlogo))
GUISetState(@SW_SHOWNA, $SplashGUIlogo)
While 1
Sleep(20)
WEnd
_GDIPlus_Shutdown()
Func _SetBitmap($hGUI, $hImage, $iOpacity, $n_width = 200, $n_height = 200)
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", $n_width)
DllStructSetData($tSize, "Y", $n_height)
$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_ReleaseDC(0, $hScrDC)
_WinAPI_SelectObject($hMemDC, $hOld)
_WinAPI_DeleteObject($hBitmap)
_WinAPI_DeleteDC($hMemDC)
EndFunc ;==>_SetBitmap