Code : Tout sélectionner
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GDIPlus.au3>
#include <WinAPI.au3>
#include <File.au3>
HotKeySet("{f1}","gui1")
HotKeySet("{f2}","gui2")
Global Const $AC_SRC_ALPHA = 1
$hGUI2 = GUICreate("OverLayMenu", 200, 200, -1, -1, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_TOPMOST)
_GDIPlus_Startup()
$hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\GTA_MenuV_off.png")
$hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage)
$w = _GDIPlus_ImageGetWidth($hImage)
$h = _GDIPlus_ImageGetHeight($hImage)
_SetBitMap($hGUI2, $hImage, 255, $w, $h)
GUISetState()
Dim $avarray, $Xpos = 150, $Var, $Blink, $GUI, $GUI1, $GUI2
_FileReadToArray(@ScriptDir&"\liste.txt",$avarray)
For $i = 1 to $avarray[0]
$Var = StringSplit($avarray[$i],",")
$Logo = $Var[1]
$Blink = $Var[2];clignotement si = 1
$Speed = $Var[3];vitesse de clignotement en ms
MySplash(@ScriptDir&"\"&$Logo, $Speed, $Blink , $Xpos,1,40,40,$GUI&$i)
$Xpos = $Xpos+52
Next
while 1
sleep(100)
Wend
Func gui1()
If BitAND(WinGetState($GUI1),2) Then
GUISetState(@SW_HIDE, $GUI1)
ElseIf Not BitAND(WinGetState($GUI1),2) Then
GUISetState(@SW_SHOW, $GUI1)
EndIf
EndFunc
Func gui2()
GUISetState(@SW_HIDE, $GUI2)
EndFunc
Func MySplash($Path_Logo, $Time_Splash, $Blink, $Xlogo, $Ylogo, $newW, $newH, $GUI)
$GUI = GUICreate("logo", $newW, $newH, $Xlogo, $Ylogo, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD),$hGUI2)
$hImage = _ImageResize($Path_Logo, $newW, $newH) ; , @DesktopCommonDir & "\Bitm.png") ;
_SetBitMap($GUI, $hImage, 255, $newW, $newH)
GUISetState()
WinSetOnTop($GUI, "", 1)
EndFunc ;==>MySplash
Func _ImageResize($sInImage, $newW, $newH);, $sOutImage = "")
Local $oldImage, $GC, $newBmp, $newGC
; If $sOutImage = "" Then _GDIPlus_Startup()
; Load Image
$oldImage = _GDIPlus_ImageLoadFromFile($sInImage)
;Create New image
$GC = _GDIPlus_ImageGetGraphicsContext($oldImage)
$newBmp = _GDIPlus_BitmapCreateFromGraphics($newW, $newH, $GC)
$newGC = _GDIPlus_ImageGetGraphicsContext($newBmp)
;Draw
_GDIPlus_GraphicsDrawImageRect($newGC, $oldImage, 0, 0, $newW, $newH)
;Cleanup
_GDIPlus_GraphicsDispose($GC)
_GDIPlus_GraphicsDispose($newGC)
_GDIPlus_ImageDispose($oldImage)
; If $sOutImage = "" Then
Return $newBmp ;
; Else
; _GDIPlus_ImageSaveToFile($newBmp, $sOutImage)
; _GDIPlus_BitmapDispose($newBmp)
; _GDIPlus_Shutdown()
; Return 1
; EndIf
EndFunc ;==>_ImageResize
Func _SetBitmap($hGUI, $hImage, $iOpacity, $n_width, $n_height)
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)
;~ 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", $AC_SRC_ALPHA)
_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