Effet interressant sur la transparence et applcations flash

Partagez vos scripts, et vos applications AutoIt.
Règles du forum
.
Répondre
marcgforce
Niveau 3
Niveau 3
Messages : 47
Enregistré le : lun. 07 mars 2016 07:20
Status : Hors ligne

Effet interressant sur la transparence et applcations flash

#1

Message par marcgforce »

Bonjour,

Je me fais le relais d'un post que j'ai trouvé intéressant sur le forum anglais et qui parle des effets de transparence possible sur l'arrière plan d'une application flash (swf) le lien est ici pour les amateurs du post original :https://www.autoitscript.com/forum/topi ... nsparency/

Pour résumer le tout, notre ami Chimp nous a concocté une toute petite application qui permet de lancer un flash dans une GUI complètement transparente, l'effet bluffant est que l'application tourne sur l’écran en laissant la main à l'utilisateur pour continuer à travailler.

Ma fille étant tombé amoureuse de ce bout de code (elle a 10 ans) je me suis mis en tête de lui faire tourner cette application en " offline " sur son poste et ainsi de rapatrier les appli flash. J'ai également placé la possibilité dans le script de choisir entre un deux sortes d'animaux.

je n'ai pas optimisé le code, il y a surement mieux a faire, mais vu le nombre de lignes que celui-ci prend je n'ai pas trouvé nécessaire de faire cette optimisation.

En ce qui concerne les SWF ils sont tirés du site http://abowman.com/ qui fait quelques petites merveilles en flash.

Voilà le code un poil modifié où j'ai remis en place les liens pour que vous n'ayez pas à télécharger les swf mais j'ai laissé en commentaire le code pour les utiliser offline :
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <Misc.au3> ; for _IsPressed (23 END key)
Local $hDLL = DllOpen("user32.dll"), $oIE = ObjCreate("Shell.Explorer.2")
Local $hBackground = GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUPWINDOW, $WS_EX_LAYERED + $WS_EX_TOPMOST)
Global $AlphaKey_white = 0xffffff ; for dog
global $AlphaKey_blue = 0xF0F7FF ; for fish
global $AlphaKey = 0xF0F7FF
; everything with color $AlphaKey within this window will be transparent
; even if within an embedded browser control!.....
msgbox(0,"FishOrDog", " Tapez 1 pour le chien " & @CRLF & " Tapez 2 pour les poissons " & @CRLF & " Fin ou Echap pour quitter" , 5)
_WinAPI_SetLayeredWindowAttributes($hBackground, $AlphaKey, 0, $LWA_COLORKEY)
GUISetState(@SW_SHOW, $hBackground)
$hIE = GUICtrlCreateObj($oIE, 0, 0, @DesktopWidth, @DesktopHeight) ; <- embedd $oIE in the AutoIt GUI

GUISetBkColor($AlphaKey, $hBackground) ; $AlphaKey $hBackground transparent
$oIE.navigate('http://cdn.abowman.com/widgets/fish/fish.swf')
;$oIE.navigate('file:///' & @ScriptDir & '/fish.swf') ; Récuperer le fichier fish.swf et activer cette ligne pour une utilisation hors ligne


;!! to use the dog, you need to set $AlphaKey = 0xffffff on line 7 "!

While True
    if _IsPressed("31", $hDLL) or _IsPressed("61", $hDLL) Then
      GUISetState(@SW_HIDE, $hBackground)
      $AlphaKey = ""
      $AlphaKey = $AlphaKey_white
      _WinAPI_SetLayeredWindowAttributes($hBackground, $AlphaKey, 0, $LWA_COLORKEY)
      GUISetState(@SW_SHOW, $hBackground)
      $hIE = GUICtrlCreateObj($oIE, 0, 0, @DesktopWidth, @DesktopHeight) ; <- embedd $oIE in the AutoIt GUI
      GUISetBkColor($AlphaKey, $hBackground) ; $AlphaKey $hBackground transparent
      $oIE.navigate('http://cdn.abowman.com/widgets/dog/dog.swf')
                ;$oIE.navigate('file:///' & @ScriptDir & '/dog.swf') ; Ici aussi recuperer dog.swf pour une utilisation hors ligne
   EndIf

   If _IsPressed("32", $hDLL) or _IsPressed("62", $hDLL) Then
      GUISetState(@SW_HIDE, $hBackground)
      $AlphaKey = ""
      $AlphaKey =$AlphaKey_blue
      _WinAPI_SetLayeredWindowAttributes($hBackground, $AlphaKey, 0, $LWA_COLORKEY)
      GUISetState(@SW_SHOW, $hBackground)
      $hIE = GUICtrlCreateObj($oIE, 0, 0, @DesktopWidth, @DesktopHeight) ; <- embedd $oIE in the AutoIt GUI
      GUISetBkColor($AlphaKey, $hBackground) ; $AlphaKey $hBackground transparent
      $oIE.navigate('http://cdn.abowman.com/widgets/fish/fish.swf')
                ;$oIE.navigate('file:///' & @ScriptDir & '/fish.swf')
   EndIf

   If _IsPressed("23", $hDLL) or _IsPressed("1B", $hDLL) Then ExitLoop ; END key was pressed
    Sleep(50)
WEnd
$oIE = ""
$hDLL = ""
GUIDelete($hBackground)
Répondre