| View previous topic :: View next topic |
| Author |
Message |
PhiLho
Joined: 27 Dec 2005 Posts: 6698 Location: France (near Paris)
|
Posted: Wed May 16, 2007 2:52 pm Post subject: Show animated Gifs in your GUI |
|
|
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 |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 3544 Location: Belgrade
|
Posted: Wed May 16, 2007 3:26 pm Post subject: |
|
|
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 |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 5286
|
Posted: Wed May 16, 2007 3:33 pm Post subject: |
|
|
Great! Many thanks PhiLho,
.. and also for Mr.Antonis Kyprianou for this wonderful DLL.
 |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 3544 Location: Belgrade
|
Posted: Wed May 16, 2007 3:36 pm Post subject: |
|
|
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  _________________
 |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 5286
|
Posted: Wed May 16, 2007 3:39 pm Post subject: |
|
|
| Quote: | 2 Skan
LOL, today is like birthday, isn't it  |
Sure it is!
Life is Beautiful  |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6698 Location: France (near Paris)
|
Posted: Wed May 16, 2007 3:43 pm Post subject: |
|
|
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 |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6698 Location: France (near Paris)
|
Posted: Wed May 16, 2007 3:50 pm Post subject: |
|
|
| 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...
Someday I might change them. _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 3544 Location: Belgrade
|
Posted: Wed May 16, 2007 5:04 pm Post subject: |
|
|
| 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.  _________________

Last edited by majkinetor on Wed May 16, 2007 5:09 pm; edited 2 times in total |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6698 Location: France (near Paris)
|
Posted: Wed May 16, 2007 5:08 pm Post subject: |
|
|
| majkinetor wrote: | U are too old for this PhiLho.  |
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 |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 3544 Location: Belgrade
|
Posted: Wed May 16, 2007 5:22 pm Post subject: |
|
|
| 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: | |
Means you don't listen.
2Skan
Your happines makes me happy  _________________
 |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6698 Location: France (near Paris)
|
Posted: Wed May 16, 2007 5:36 pm Post subject: |
|
|
| 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 |
|
 |
freakkk
Joined: 29 Jul 2005 Posts: 114
|
Posted: Wed May 16, 2007 5:37 pm Post subject: |
|
|
| 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 |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6698 Location: France (near Paris)
|
Posted: Wed May 16, 2007 5:40 pm Post subject: |
|
|
| 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 |
|
 |
freakkk
Joined: 29 Jul 2005 Posts: 114
|
Posted: Wed May 16, 2007 5:44 pm Post subject: |
|
|
I believe it is too. What really didn't make sense to me was the Str also works Maybe it isn't actually freeing the library-- but just exiting w/out erroring  _________________ .o0[ corey ]0o. |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 3544 Location: Belgrade
|
Posted: Wed May 16, 2007 5:50 pm Post subject: |
|
|
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 |
|
 |
|