AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Load A Flash Animation Into A GUI Created Using AHK

 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Aravind



Joined: 30 Oct 2009
Posts: 58
Location: Kerala, India

PostPosted: Thu Dec 17, 2009 4:03 pm    Post subject: Load A Flash Animation Into A GUI Created Using AHK Reply with quote

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 Sad . 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 Embarassed & 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 Smile


Don't Ask About My GUI Design Ok? I'm Very Weak In GUI Design Sad !
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 Very Happy

Comments/Suggestions Are Expected Exclamation


Thanks & Regards
_________________


Don't Take Life Too Seriously,Because In The End, You Won't Escape It Alive Anyway Wink


Last edited by Aravind on Fri Dec 18, 2009 4:23 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
SoggyDog



Joined: 02 May 2006
Posts: 783
Location: Greeley, CO

PostPosted: Thu Dec 17, 2009 4:49 pm    Post subject: Reply with quote

Tried it;
Liked it;
Got the following error on exit.


_________________

SoggyDog
Dwarf Fortress:
"The most intriguing game I've ever played."
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Aravind



Joined: 30 Oct 2009
Posts: 58
Location: Kerala, India

PostPosted: Thu Dec 17, 2009 5:11 pm    Post subject: Reply with quote

Thanks! Glad you liked it Very Happy

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 Wink
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
HotKeyIt



Joined: 18 Jun 2008
Posts: 4652
Location: AHK Forum

PostPosted: Thu Dec 17, 2009 5:18 pm    Post subject: Reply with quote

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 Wink
Back to top
View user's profile Send private message
Aravind



Joined: 30 Oct 2009
Posts: 58
Location: Kerala, India

PostPosted: Thu Dec 17, 2009 5:23 pm    Post subject: Reply with quote

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 Wink
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
Aravind



Joined: 30 Oct 2009
Posts: 58
Location: Kerala, India

PostPosted: Thu Dec 17, 2009 5:31 pm    Post subject: Reply with quote

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 Wink
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
SoggyDog



Joined: 02 May 2006
Posts: 783
Location: Greeley, CO

PostPosted: Thu Dec 17, 2009 6:38 pm    Post subject: Reply with quote

Fix confirmed;
Well done.
_________________

SoggyDog
Dwarf Fortress:
"The most intriguing game I've ever played."
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Repkam09



Joined: 11 Feb 2008
Posts: 15
Location: USA

PostPosted: Fri Dec 18, 2009 5:58 pm    Post subject: cool :) Reply with quote

Thats pretty nifty! Very Happy
_________________
[repkam09]
AHK Beginner Razz
Back to top
View user's profile Send private message AIM Address
tank



Joined: 21 Dec 2007
Posts: 3700
Location: Louisville KY USA

PostPosted: Sat Dec 19, 2009 6:04 am    Post subject: Reply with quote

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
View user's profile Send private message
Sean



Joined: 12 Feb 2007
Posts: 2462

PostPosted: Sat Dec 19, 2009 11:02 am    Post subject: Reply with quote

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
View user's profile Send private message
tank



Joined: 21 Dec 2007
Posts: 3700
Location: Louisville KY USA

PostPosted: Sat Dec 19, 2009 9:34 pm    Post subject: Reply with quote

Not to offend you Sean Laughing i of course Wink 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 Rolling Eyes Confused
_________________

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
View user's profile Send private message
Sean



Joined: 12 Feb 2007
Posts: 2462

PostPosted: Sun Dec 20, 2009 12:02 am    Post subject: Reply with quote

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
View user's profile Send private message
tank



Joined: 21 Dec 2007
Posts: 3700
Location: Louisville KY USA

PostPosted: Sun Dec 20, 2009 12:22 am    Post subject: Reply with quote

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
View user's profile Send private message
DetroitAutoHotkey



Joined: 12 Nov 2010
Posts: 51

PostPosted: Mon May 16, 2011 6:46 pm    Post subject: Reply with quote

How do you disable the borders around the flash movie?
Back to top
View user's profile Send private message
DetroitAutoHotkey



Joined: 12 Nov 2010
Posts: 51

PostPosted: Tue May 17, 2011 3:19 pm    Post subject: Reply with quote

Anyone?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group