AutoHotkey Community

It is currently May 25th, 2012, 5:29 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 49 posts ]  Go to page 1, 2, 3, 4  Next
Author Message
PostPosted: May 16th, 2007, 2:52 pm 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
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=dow ... w&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.

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


Last edited by PhiLho on May 28th, 2007, 10:58 am, edited 5 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 16th, 2007, 3:26 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
Its not lack of library. Examples clearly show that.

_________________
Image


Last edited by majkinetor on May 16th, 2007, 3:36 pm, edited 2 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 16th, 2007, 3:33 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8775
Great! Many thanks PhiLho, :D

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

:)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 16th, 2007, 3:36 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
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 :D

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 16th, 2007, 3:39 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8775
Quote:
2 Skan
LOL, today is like birthday, isn't it :D


Sure it is!
Life is Beautiful :D


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 16th, 2007, 3:43 pm 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
Updated script, uploaded latest DLL, which is downloaded automatically.

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 16th, 2007, 3:50 pm 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
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.

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 16th, 2007, 5:04 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
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. :!:

_________________
Image


Last edited by majkinetor on May 16th, 2007, 5:09 pm, edited 2 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 16th, 2007, 5:08 pm 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
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.

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 16th, 2007, 5:22 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
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 :)

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 16th, 2007, 5:36 pm 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
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.

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


Last edited by PhiLho on May 16th, 2007, 5:38 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 16th, 2007, 5:37 pm 
Offline

Joined: July 29th, 2005, 5:32 pm
Posts: 179
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 16th, 2007, 5:40 pm 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
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.

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 16th, 2007, 5:44 pm 
Offline

Joined: July 29th, 2005, 5:32 pm
Posts: 179
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 16th, 2007, 5:50 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
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...

_________________
Image


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Yahoo [Bot], ZeLen1y and 10 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