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 

Show animated Gifs in your GUI
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
PhiLho



Joined: 27 Dec 2005
Posts: 6698
Location: France (near Paris)

PostPosted: Wed May 16, 2007 2:52 pm    Post subject: Show animated Gifs in your GUI Reply with quote

This has been often asked, here it is, at least!
Thanks to majkinetor which found a gold mine of custom Windows controls written in assembly language: they are small, they are fast, they are mean!

In the forum pointed out in RaGrid - Extreme Grid control, I found an AniGIF control and I tried to write a wrapper for it. Here is the result.

Control_AniGif.ahk

I used four Gif files for the demo, links below. The first two were "stolen" to deviantART, credit goes to them and their creators. The last one is static, on purpose.
http://autohotkey.net/~PhiLho/Images/pacman.gif
http://autohotkey.net/~PhiLho/Images/teleport.gif
http://autohotkey.net/~PhiLho/Images/Flag_France.gif
http://autohotkey.net/~PhiLho/Images/Earth.gif
[EDIT] Changed the script to automatically download them if not in the script dir.

And of course, you need the DLL, which can be found at the WinAsm site: http://www.winasm.net/index.php?ind=downloads&op=entry_view&iden=150
[EDIT] The above link is outdated but it is freely available, so I leave it. You have to register to the WinAsm forum to get the latest file, so I uploaded the DLL to my AutoHotkey.net account (automatically downloaded by the script, too). http://autohotkey.net/~PhiLho/AniGIF.dll

The last problem is that the displayed Gifs lack transparency. I don't know if I must add a style to change this, or if that's a limitation of the library.

[EDIT] I found out, I must not take the public zip file but I had to register to the forum to get the latest file from the topic... This one adds the WAGM_SETBKCOLOR and transparency!
For your convenience, I provide the DLL, hoping the author doesn't mind. I copy his copyright in the source, since I have no About box...
Quote:
;|AniGIF is a copyright of Antonis Kyprianou. |
;| |
;|You can use AniGIF for NON commercial purposes provided you |
;|have the following information on your application's about box: |
;|AniGIF control is copyright of Antonis Kyprianou (http://www.winasm.net)|
;| |
;|You need my WRITTEN permission to use AniGIF in commercial applications |


[EDIT] Better encapsulation (everything in functions), styles given as strings, hyperlink working in the demo.

Quote:
// File/Project history:
1.03.000 -- 2007/05/17 (PL) -- Total encapsulation.
1.02.000 -- 2007/05/16 (PL) -- Changed functions names (thanks majkinetor), added more wrappers, freed correctly DLL.
1.01.000 -- 2007/05/16 (PL) -- Update to 1.0.4.0 with WAGM_SETBKCOLOR.
1.00.000 -- 2007/05/16 (PL) -- Creation.

_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Last edited by PhiLho on Mon May 28, 2007 10:58 am; edited 5 times in total
Back to top
View user's profile Send private message Visit poster's website
majkinetor



Joined: 24 May 2006
Posts: 3544
Location: Belgrade

PostPosted: Wed May 16, 2007 3:26 pm    Post subject: Reply with quote

Its not lack of library. Examples clearly show that.
_________________


Last edited by majkinetor on Wed May 16, 2007 3:36 pm; edited 2 times in total
Back to top
View user's profile Send private message MSN Messenger
SKAN



Joined: 26 Dec 2005
Posts: 5286

PostPosted: Wed May 16, 2007 3:33 pm    Post subject: Reply with quote

Great! Many thanks PhiLho, Very Happy

.. and also for Mr.Antonis Kyprianou for this wonderful DLL.

Smile
Back to top
View user's profile Send private message
majkinetor



Joined: 24 May 2006
Posts: 3544
Location: Belgrade

PostPosted: Wed May 16, 2007 3:36 pm    Post subject: Reply with quote

I don't know why you didn't follow API design I used. I don't like how you wrapped it, as I have to copy/paste around instad just to include AniGif.

What acctually adds the damn things just looking from names ?
Code:
GuiAddAniGif
GuiControlAddAniGif


The principle I planned to used for all controls that are to be wrapped is

CtrlName_Add( ) - to add to the gui, returns handle
CtrlName_MsgName

where CtrlName can eventualy be shorthand and "GIF" word stripped off.

So, the names should be:
Code:
AniGif_Add()
AniGif_Zoom()
AniGif_LoadFromFile()
AniGif_SetHyperLink()
AniGif_Unload()

saved in the file AniGif.ahk

Also, use Antonis desires to use http://www.winasm.net link to point to his location. Its Ok to include dll in your archive.

2 Skan
LOL, today is like birthday, isn't it Very Happy
_________________
Back to top
View user's profile Send private message MSN Messenger
SKAN



Joined: 26 Dec 2005
Posts: 5286

PostPosted: Wed May 16, 2007 3:39 pm    Post subject: Reply with quote

Quote:
2 Skan
LOL, today is like birthday, isn't it Very Happy


Sure it is!
Life is Beautiful Very Happy
Back to top
View user's profile Send private message
PhiLho



Joined: 27 Dec 2005
Posts: 6698
Location: France (near Paris)

PostPosted: Wed May 16, 2007 3:43 pm    Post subject: Reply with quote

Updated script, uploaded latest DLL, which is downloaded automatically.
_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Back to top
View user's profile Send private message Visit poster's website
PhiLho



Joined: 27 Dec 2005
Posts: 6698
Location: France (near Paris)

PostPosted: Wed May 16, 2007 3:50 pm    Post subject: Reply with quote

majkinetor wrote:
I don't know why you didn't follow API design I used. I don't like how you wrapped it, as I have to copy/paste around instad just to include AniGif.
I didn't knew you established an authoritative norm for DLL control wrapping...
You shouldn't have to copy/paste around, the file is designed to be included on top of the script that uses the control.
I used a similar scheme for CreateWindow_AVI.ahk and CreateWindow_IPA.ahk
The idea was to provide functions names similar to the AHK GUI commands...

Now, I must admit I am not super-happy with these names (slightly obfuscated indeed), and your naming scheme isn't so bad... Smile
Someday I might change them.
_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Back to top
View user's profile Send private message Visit poster's website
majkinetor



Joined: 24 May 2006
Posts: 3544
Location: Belgrade

PostPosted: Wed May 16, 2007 5:04 pm    Post subject: Reply with quote

Quote:
I didn't knew you established an authoritative norm for DLL control wrapping...


Quote:
You shouldn't have to copy/paste around, the file is designed to be included on top of the script that uses the control.


U are too old for this PhiLho. Exclamation
_________________


Last edited by majkinetor on Wed May 16, 2007 5:09 pm; edited 2 times in total
Back to top
View user's profile Send private message MSN Messenger
PhiLho



Joined: 27 Dec 2005
Posts: 6698
Location: France (near Paris)

PostPosted: Wed May 16, 2007 5:08 pm    Post subject: Reply with quote

majkinetor wrote:
U are too old for this PhiLho. Exclamation
Question

BTW, I would use AniGif_CreateControl instead of AniGif_Add, as the later scheme is more likely to clash with some message name in some control.
_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Back to top
View user's profile Send private message Visit poster's website
majkinetor



Joined: 24 May 2006
Posts: 3544
Location: Belgrade

PostPosted: Wed May 16, 2007 5:22 pm    Post subject: Reply with quote

Quote:
as the later scheme is more likely to clash with some message name in some control.

Not at all. Its not by the MS Standard to use message name like ADD. Each control has unique prefix, that is clearly visible if you snoop around the masm forum or MSDN.

Quote:
You shouldn't have to copy/paste around, the file is designed to be included on top of the script that uses the control.

Why should I include your presentation GUI ?

Quote:
I didn't knew you established an authoritative norm for DLL control wrapping...
Open your eyes. Not just me. Sean didn't had the problem to switch in one word. Contrary to that U choosed to spread disorganisation instead we all stick to the same standard.

Quote:
Now, I must admit I am not super-happy with these names (slightly obfuscated indeed)

Slightly ?
Question for million dolars. Which function does what ?
    Quote:
    GuiAddAniGif
    GuiControlAddAniGif


Quote:
I used a similar scheme for CreateWindow_AVI.ahk and CreateWindow_IPA.ahk
So you had bad choice more then once.

Quote:
Question

Means you don't listen.

2Skan
Your happines makes me happy Smile
_________________
Back to top
View user's profile Send private message MSN Messenger
PhiLho



Joined: 27 Dec 2005
Posts: 6698
Location: France (near Paris)

PostPosted: Wed May 16, 2007 5:36 pm    Post subject: Reply with quote

majkinetor wrote:
Quote:
as the later scheme is more likely to clash with some message name in some control.

Not at all. Its not by the MS Standard to use message name like ADD. Each control has unique prefix, that is clearly visible if you snoop around the masm forum or MSDN.
You removed these prefixes... As I wrote, one can find a WAGM_ADD message or similar.

Quote:
Quote:
You shouldn't have to copy/paste around, the file is designed to be included on top of the script that uses the control.

Why should I include your presentation GUI ?
Indeed, but:
1) It is very easy to remove it. That's not a compiled program;
2) It isn't that long.

Quote:
Quote:
I didn't knew you established an authoritative norm for DLL control wrapping...
Open your eyes. Not just me. Sean didn't had the problem to switch in one word. Contrary to that U choosed to spread disorganisation instead we all stick to the same standard.
I didn't saw where this standard was published...
As I wrote, it isn't a bad standard, but don't reproach me not to download all the scripts you wrote and to study them closely.

Quote:
Means you don't listen.
No, means you are unclear.
_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Last edited by PhiLho on Wed May 16, 2007 5:38 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
freakkk



Joined: 29 Jul 2005
Posts: 114

PostPosted: Wed May 16, 2007 5:37 pm    Post subject: Reply with quote

Code:
CreateWindow_AniGif_Exit:
; Deactivated as it crashes my script!?
   If (hAniGifModule != "" and hAniGifModule != 0)
      DllCall("FreeLibrary", "UInt", hAniGifModule)
ExitApp
I tried using
Code:
DllCall("FreeLibrary", "UInt *", hAniGifModule)
..and it seems okay.
_________________
.o0[ corey ]0o.
Back to top
View user's profile Send private message
PhiLho



Joined: 27 Dec 2005
Posts: 6698
Location: France (near Paris)

PostPosted: Wed May 16, 2007 5:40 pm    Post subject: Reply with quote

freakkk wrote:
Code:
DllCall("FreeLibrary", "UInt *", hAniGifModule)
..and it seems okay.
Uh? It might work but it makes no sense... Oh well, I believe the DLL is unloaded when the script ends, anyway.
_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Back to top
View user's profile Send private message Visit poster's website
freakkk



Joined: 29 Jul 2005
Posts: 114

PostPosted: Wed May 16, 2007 5:44 pm    Post subject: Reply with quote

I believe it is too. What really didn't make sense to me was the Str also works Exclamation Question Maybe it isn't actually freeing the library-- but just exiting w/out erroring Smile
_________________
.o0[ corey ]0o.
Back to top
View user's profile Send private message
majkinetor



Joined: 24 May 2006
Posts: 3544
Location: Belgrade

PostPosted: Wed May 16, 2007 5:50 pm    Post subject: Reply with quote

Don't explicitely unload DLL, if it doesn't crash you have luck. DLL registers itself as a class so it is recorded by local subsistem. I beleive unloading dll is the last thing that should be done after series or other destructors, like unregistering the class, etc...
_________________
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page 1, 2, 3  Next
Page 1 of 3

 
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