 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Aravind
Joined: 30 Oct 2009 Posts: 58 Location: Kerala, India
|
Posted: Thu Dec 17, 2009 4:03 pm Post subject: Load A Flash Animation Into A GUI Created Using AHK |
|
|
I've spent a whole night searching the AHK Script & Functions Forum to find a post on "Embedding A Flash Animation In AHK GUI". But no one seemed interested & my search ended in vain. I've even posted a thread at the Ask For Help forum as a last resort & waited for 2 long days!. But no luck was there also . Then i have started experimenting on IE controls in AHK GUI windows & figured it out that a Flash Movie can be loaded into the IE control created inside an AHK window.
Imagine A Cool Custom Intro Before Starting Your Application Created Using AHK!!
Well, i've imagined it earlier & i couldn't get it out of my mind.
That resulted in developing the following script.
Download Example
Limitations
1) Flash Player Must Be Installed In The Host Computer
2) Absolutely No Response From Movie Can Be Registered By AHK !
3) Requires A Child-Window To Load The Movie
4) No Way To Detect Whether The Movie Is Playing Or Not
Post Any Other Problem That I'm Unaware Of
Don't Ask About My GUI Design Ok? I'm Very Weak In GUI Design !
Please Let Me Know If There Are Further Modifications Possible.
I Don't Know Of Any Other Way To Embed Flash Animations In A More Efficient Way. This Is Just A Possibility & There Could Be Many Ways. I Thought This Post May Kick Start All Those Bright Minds, Here In The AHK Forum
Comments/Suggestions Are Expected
Thanks & Regards _________________
Don't Take Life Too Seriously,Because In The End, You Won't Escape It Alive Anyway
Last edited by Aravind on Fri Dec 18, 2009 4:23 am; edited 1 time in total |
|
| Back to top |
|
 |
SoggyDog
Joined: 02 May 2006 Posts: 783 Location: Greeley, CO
|
|
| Back to top |
|
 |
Aravind
Joined: 30 Oct 2009 Posts: 58 Location: Kerala, India
|
Posted: Thu Dec 17, 2009 5:11 pm Post subject: |
|
|
Thanks! Glad you liked it
About the error message you got, since it occurred during program termination, it could be a bug in the OnExit subroutine. I'll try to give you a complete explanation. _________________
Don't Take Life Too Seriously,Because In The End, You Won't Escape It Alive Anyway |
|
| Back to top |
|
 |
HotKeyIt
Joined: 18 Jun 2008 Posts: 4652 Location: AHK Forum
|
Posted: Thu Dec 17, 2009 5:18 pm Post subject: |
|
|
This looks nice, thanks for sharing.
You should change your Exit routine, because it is launched twice, once when you goto and second time when ExitApp is launched.
Something like this, possibly that is why the error is coming up as well | Code: | Gui,-caption
Gui,Add,Picture,x0 y0,Line.jpg
Gui,Add,Picture,x0 y0,Line2.jpg
Gui,Add,Picture,x0 y497,Line.jpg
Gui,Add,Picture,x597 y0,Line2.jpg
Gui,Add,Picture,x5 y10,Header.jpg
Gui,add,picture,x560 y6 gGuiClose,close.jpg
Gui,Add,Text,x15 y350,Special Thanks Goes To daonlyfreez,SKAN,Titan And Chris`nThis Is Just A Possibility. I Don't Know Whether There Is Any Other Way To Do This.`nI Thought This Might Kick Start Some Of The Great And Bright Minds Out Here At The AHK Forum!`n`nCode By Aravind.V.S`nvsaravind007@gmail.com
Gui,color,FFFFFF
Gui, Show, w600 h500,Embedding A Flash Movie In Autohotkey GUI
WinGet, ourHWND, ID, A
OnExit, OnExit
;--------->Flash Animation Loader
Gui, 2: Color,FFFFFF
Gui, 2: +ToolWindow -Caption
Gui, 2: Show,x40 y120 w508 h216
WinGet, LoaderHandle, ID, A
Gui, 2: +LastFound
DllCall("SetParent", "uint", WinExist(), "uint", ourHWND)
;--------------->Load Library To Memory
hModule := DllCall("LoadLibrary", "str", "cwebpage.dll")
;--------------->Create A Browser Control In The LoaderHandle
res := DLLCall("cwebpage\EmbedBrowserObject", UInt, LoaderHandle)
If (res != 0 Or ErrorLevel != 0)
ExitApp
;--------------->Load The Specified Flash Animation To The Browser Control
Path=%A_ScriptDir%\Intro.swf
res := DLLCall("cwebpage\DisplayHTMLPage", UInt, LoaderHandle, Str, path)
If (res != 0 Or ErrorLevel != 0)
ExitApp
return
;--------------->Clean Up Routine To Freeup The Memory
GuiClose:
ExitApp
OnExit:
DLLCall("cwebpage\UnEmbedBrowserObject", UInt, LoaderHandle)
DllCall("FreeLibrary", "UInt", hModule)
ExitApp
|
_________________ AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun  |
|
| Back to top |
|
 |
Aravind
Joined: 30 Oct 2009 Posts: 58 Location: Kerala, India
|
Posted: Thu Dec 17, 2009 5:23 pm Post subject: |
|
|
You are right HotKeyIt ! I often do crazy things & guess what? This is also an example of my idiocy! Anyway, Thanks for your review & bug report along with the solution. You saved me a lot of time figuring out the problem ! _________________
Don't Take Life Too Seriously,Because In The End, You Won't Escape It Alive Anyway |
|
| Back to top |
|
 |
Aravind
Joined: 30 Oct 2009 Posts: 58 Location: Kerala, India
|
Posted: Thu Dec 17, 2009 5:31 pm Post subject: |
|
|
OnExit Dual Execution Problem Fixed!
I've updated the code with a new exit routine. In the old code, the Onexit subroutine executed twice & created an error message in some computers because it tries to unload the already unloaded dll causing an error to pop up.
Please ReDownload SoggyDog
Thanks To HotKeyIt For His Solution! _________________
Don't Take Life Too Seriously,Because In The End, You Won't Escape It Alive Anyway |
|
| Back to top |
|
 |
SoggyDog
Joined: 02 May 2006 Posts: 783 Location: Greeley, CO
|
|
| Back to top |
|
 |
Repkam09
Joined: 11 Feb 2008 Posts: 15 Location: USA
|
Posted: Fri Dec 18, 2009 5:58 pm Post subject: cool :) |
|
|
Thats pretty nifty!  _________________ [repkam09]
AHK Beginner  |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 3700 Location: Louisville KY USA
|
Posted: Sat Dec 19, 2009 6:04 am Post subject: |
|
|
frakkin cool and simple amount of code _________________
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed; |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 2462
|
Posted: Sat Dec 19, 2009 11:02 am Post subject: |
|
|
It can be done simply:
| Code: | COM_AtlAxWinInit()
pweb := COM_AtlAxCreateControl(LoaderHandle,Path)
; pswf := COM_AtlAxCreateControl(LoaderHandle,"ShockwaveFlash.ShockwaveFlash"), COM_Invoke(pswf,"Movie",Path)
|
|
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 3700 Location: Louisville KY USA
|
Posted: Sat Dec 19, 2009 9:34 pm Post subject: |
|
|
Not to offend you Sean i of course know this but this example requires no library and i hadnt actually seen this thread before now
It of course has huge limitations over the use of the atl methods as it doesnt provide ready access to DOM but for simple display of content where DOM access isnt necesary nor resizes it has its advantages
as you know some folks still think length of code matters enuff to avoid COM  _________________
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed; |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 2462
|
Posted: Sun Dec 20, 2009 12:02 am Post subject: |
|
|
| I posted it because I had found that cwebpage.dll was buggy. My first job in AHK after Chris accepted my request for the function pointer support in DllCall was to convert WebBrowser control in cwebpage.dll with that in AHK alone, so I had to paly with it for a while. |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 3700 Location: Louisville KY USA
|
Posted: Sun Dec 20, 2009 12:22 am Post subject: |
|
|
yes i totally agree its not suited for anything much more advanced than the way its used here _________________
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed; |
|
| Back to top |
|
 |
DetroitAutoHotkey
Joined: 12 Nov 2010 Posts: 51
|
Posted: Mon May 16, 2011 6:46 pm Post subject: |
|
|
| How do you disable the borders around the flash movie? |
|
| Back to top |
|
 |
DetroitAutoHotkey
Joined: 12 Nov 2010 Posts: 51
|
Posted: Tue May 17, 2011 3:19 pm Post subject: |
|
|
| Anyone? |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|