AutoHotkey Community

It is currently May 27th, 2012, 3:57 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: December 17th, 2009, 5:03 pm 
Offline

Joined: October 30th, 2009, 7:32 am
Posts: 64
Location: Kerala, India
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 :oops: & 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 :D

Comments/Suggestions Are Expected :!:


Thanks & Regards

_________________
Image

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


Last edited by Aravind on December 18th, 2009, 5:23 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 17th, 2009, 5:49 pm 
Offline

Joined: May 2nd, 2006, 11:16 pm
Posts: 800
Location: Greeley, CO
Tried it;
Liked it;
Got the following error on exit.

Image

_________________
Image
SoggyDog
Dwarf Fortress:
"The most intriguing game I've ever played."


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 17th, 2009, 6:11 pm 
Offline

Joined: October 30th, 2009, 7:32 am
Posts: 64
Location: Kerala, India
Thanks! Glad you liked it :D

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.

_________________
Image

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 17th, 2009, 6:18 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
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:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 17th, 2009, 6:23 pm 
Offline

Joined: October 30th, 2009, 7:32 am
Posts: 64
Location: Kerala, India
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 !

_________________
Image

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 17th, 2009, 6:31 pm 
Offline

Joined: October 30th, 2009, 7:32 am
Posts: 64
Location: Kerala, India
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!

_________________
Image

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 17th, 2009, 7:38 pm 
Offline

Joined: May 2nd, 2006, 11:16 pm
Posts: 800
Location: Greeley, CO
Fix confirmed;
Well done.

_________________
Image
SoggyDog
Dwarf Fortress:
"The most intriguing game I've ever played."


Report this post
Top
 Profile  
Reply with quote  
 Post subject: cool :)
PostPosted: December 18th, 2009, 6:58 pm 
Offline

Joined: February 11th, 2008, 6:24 pm
Posts: 15
Location: USA
Thats pretty nifty! :D

_________________
[repkam09]
AHK Beginner :P


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 19th, 2009, 7:04 am 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
frakkin cool and simple amount of code

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 19th, 2009, 12:02 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
It can be done simply:
Code:
COM_AtlAxWinInit()
pweb := COM_AtlAxCreateControl(LoaderHandle,Path)
; pswf := COM_AtlAxCreateControl(LoaderHandle,"ShockwaveFlash.ShockwaveFlash"), COM_Invoke(pswf,"Movie",Path)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 19th, 2009, 10:34 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
Not to offend you Sean :lol: i of course :wink: know this but this example requires no library and i hadnt actually seen this threadbefore 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 :roll: :?

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 20th, 2009, 1:02 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 20th, 2009, 1:22 am 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
yes i totally agree its not suited for anything much more advanced than the way its used here

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 16th, 2011, 7:46 pm 
Offline

Joined: November 12th, 2010, 3:35 am
Posts: 63
How do you disable the borders around the flash movie?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 17th, 2011, 4:19 pm 
Offline

Joined: November 12th, 2010, 3:35 am
Posts: 63
Anyone?


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 25 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group