leonidas Posted December 2, 2009 Share Posted December 2, 2009 Hello I'm trying to make program that will work like windows desktop but for background image and buttons to use an .swf (Adobe Flash) file. Program works fine with buttons and background but it's nor really working like windows desktop do. If I dont DISABLE the main GUI it works fine (buttons,effects and e.t.c) but when I click at background (click at shockwave object) the GUI window comes at the top of all other windows. If I make main GUI DISABLE then it works like windows desktop (my program doesnt come at the top of all others) but buttons and flash effects not working at all. Please I will appreciate any help about this problem I have. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $FlashFile = @ScriptDir & "\test.swf" Dim $oSW = ObjCreate('ShockwaveFlash.ShockwaveFlash.1') ObjEvent($oSW, 'Shockwave_') Dim $hGUI = GUICreate("MainGUI", @DesktopWidth, @DesktopHeight - 20,0,0,$WS_POPUP, WinGetHandle("[CLASS:Progman]")) ;GUISetState(@SW_DISABLE,$hGUI) Dim $Shockwave = GUICtrlCreateObj($oSW, 0, 0, @DesktopWidth, @DesktopHeight - 20) $swfObjEvents = ObjEvent($oSW,"FSCommand") GUISetState() With $oSW $oSW.LoadMovie(0,$FlashFile) $oSW.Play EndWith While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit WEnd Func FSCommand($type,$command,$arguments) If $type = "FSCommand" Then If $command <> "fullscreen" AND $command <> "allowscale" AND $command <> "showmenu" Then Run($arguments) EndIf EndFunc Here are .au3 anf .swf files FlashDesktop.rar Link to comment Share on other sites More sharing options...
Mat Posted December 2, 2009 Share Posted December 2, 2009 http://msdn.microsoft.com/en-us/library/ms633545(VS.85).aspx #Include<Constants.au3> #Include<WinApi.au3> $hWnd = WinGetHandle ("Untitled - Notepad") MsgBox (0, _WinAPI_SetWindowPos ($hWnd, $HWND_BOTTOM, 0, 0, 0, 0, $SWP_NOMOVE + $SWP_NOSIZE), @Error) Not sure if its completely perfect. Mat AutoIt Project Listing Link to comment Share on other sites More sharing options...
leonidas Posted December 2, 2009 Author Share Posted December 2, 2009 Can you please tell me how to use the command you send me to my program? Cause I not understand exactly how it works. Anyway ,thanks for your answer. Link to comment Share on other sites More sharing options...
leonidas Posted December 3, 2009 Author Share Posted December 3, 2009 Mat , I search more about the _WinAPI_SetWindowPos and you was right. The problem I had was solved and here is the new-fixed code #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Constants.au3> #Include <WinAPI.au3> Global $FlashFile = @ScriptDir & "\test.swf" Dim $oSW = ObjCreate('ShockwaveFlash.ShockwaveFlash.1') ObjEvent($oSW, 'Shockwave_') Dim $hGUI = GUICreate("MainGUI", @DesktopWidth, @DesktopHeight - 20,0,0,$WS_POPUP,-1, WinGetHandle("[CLASS:Progman]")) ;GUISetState(@SW_DISABLE,$hGUI) Dim $Shockwave = GUICtrlCreateObj($oSW, 0, 0, @DesktopWidth, @DesktopHeight - 20) $swfObjEvents = ObjEvent($oSW,"FSCommand") GUISetState() With $oSW $oSW.LoadMovie(0,$FlashFile) $oSW.Play EndWith While 1 _WinAPI_SetWindowPos($hGUI, $HWND_BOTTOM, 0, 0, 0, 0, BitOR($SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE)) $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit WEnd Func FSCommand($type,$command,$arguments) If $type = "FSCommand" Then If $command <> "fullscreen" AND $command <> "allowscale" AND $command <> "showmenu" Then Run($arguments) EndIf EndFunc but now I have a new problem. When I change from Active window to another window or when I click at desktop background, all windows flickering for less than a second but it not looks nice. It seems like desktop program comes at the top and go again at the bottom from the _WinAPI_SetWindowPos command. Can someone help with this? Link to comment Share on other sites More sharing options...
Mat Posted December 3, 2009 Share Posted December 3, 2009 Still not perfect but a slight improvement... expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Constants.au3> #Include <WinAPI.au3> Global $FlashFile = @ScriptDir & "\test.swf" Dim $oSW = ObjCreate('ShockwaveFlash.ShockwaveFlash.1') ObjEvent($oSW, 'Shockwave_') Dim $hGUI = GUICreate("MainGUI", 10, 10, -100, -100,$WS_POPUP,-1, WinGetHandle("[CLASS:Progman]")) ;GUISetState(@SW_DISABLE,$hGUI) Dim $Shockwave = GUICtrlCreateObj($oSW, 0, 0, @DesktopWidth, @DesktopHeight - 20) $swfObjEvents = ObjEvent($oSW,"FSCommand") $cur = WinGetHandle ("[active]") GUISetState() _WinAPI_SetWindowPos($hGUI, $HWND_BOTTOM, 0, 0, @DesktopWidth, @DesktopHeight - 20, $SWP_NOACTIVATE) WinActivate ($cur) With $oSW $oSW.LoadMovie(0,$FlashFile) $oSW.Play EndWith While 1 _WinAPI_SetWindowPos($hGUI, $HWND_BOTTOM, 0, 0, @DesktopWidth, @DesktopHeight - 20, BitOR($SWP_NOMOVE, $SWP_NOSIZE, $SWP_NOACTIVATE)) $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit WEnd Func FSCommand($type,$command,$arguments) If $type = "FSCommand" Then If $command <> "fullscreen" AND $command <> "allowscale" AND $command <> "showmenu" Then Run($arguments) EndIf EndFunc Mat AutoIt Project Listing Link to comment Share on other sites More sharing options...
skyboy Posted December 6, 2009 Share Posted December 6, 2009 i've found a simpler way to do this without autoit at all (unless you want to use autoit to modify the html file to change the swf application and reset the background to something then back to the html file. javascript executed in the html file can read/write to the registry, start applications, and probably even use I/O resources) this is a sample htm file (note, you should keep it as a .htm instead of .html): you need only change the 'file' variable if you want a different swf, it can probably come from an internet resource too since i stuck the internet MOW up there (ensures installing IE7+ doesn't break your wallpaper); and to avoid the 'click to use this control' thing, it's written using the SWFObject from googlecode (externally linked) <!-- saved from url=(0014)about:internet --><html><head><script src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js" lanuage="javascript"></script> <title>Lighting</title><style>* {margin:0;padding:0;position:fixed;top:0px;left:0px;}</style></head><body bgcolor="#000000"><p id="bg"></p><script Language="javascript"> var file = "Lighting\\asteroids.swf" swfobject.embedSWF(file,"bg","100%","100%","9",false,{},{bgcolor:"#000000",allownetworking:"all",allowscriptaccess:"always",wmode:"opaque"},{}); </script></body></html> Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now