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 Previous  1, 2, 3, 4  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
n-l-i-d
Guest





PostPosted: Fri May 18, 2007 12:40 pm    Post subject: Reply with quote

In general I am a very patient person, very patient, but I can imagine others becoming less patient if you continue like this, or you might simply get ignored one day, I already warned you about that.

You are definitely right that some changes are necessary, but I think you are only working against improving the situation for all of us, if you keep "calling names".

Calling people "childish/kids/n00bs/unprofessional" and other things is not going to help (but I'm repeating myself now)... it isn't, no matter how "right" you might be...

Understand that everything here is voluntary, and you calling people that offer their free-time to improve this project "unprofessional" or "not-serious" is - again - rude, and will only shun those away.

I don't mind strong language, not at all, but one of the good things of this forum is that usually people refrain from using strong language, and try helping others, even if these other users are new and don't know much yet. The way you are acting around here is quite contrary to this general attitude. So, in your own interest, try keeping it down a bit, it's better for everybody (including myself, I have very egotistical reasons for this opinion). Look at what happened with AutoIt. The snobbish approach of the moderators/coders there made very many people leave... Would't want to happen similar things to AutoHotkey...

Wink
Back to top
majkinetor



Joined: 24 May 2006
Posts: 4511
Location: Belgrade

PostPosted: Fri May 18, 2007 1:47 pm    Post subject: Reply with quote

Quote:
or you might simply get ignored one day, I already warned you about that.

And how is that different from now ?

Quote:
but I can imagine others becoming less patient if you continue like this

And they will do what ? Kill me ? Scream at me ? Cmon...

Quote:
Calling people "childish/kids/n00bs/unprofessional" and other things is not going to help (but I'm repeating myself now)... it isn't, no matter how "right" you might be...

Well, asking them nicely didn't help too. So lets try differently for a change. It is matter of how "right" one is. I am not here to spread cookies but I try to impose some standards here. That is the difference between child and mature man - its seeing the truth between the words.
I am repeating myself now, but instead of talking again, you should do different things and support standardisation with all voices you have. Its no about me either as you constantly say "you this, you that". If U think you have good/bad model for standardisation, say it, and force it, I will support it (and not screming at you: "HEJ, DON'T TELL ME HOW TO PROGRAMM, I AM HERE ON VACATION). Any law, is better then no law.

Quote:
Understand that everything here is voluntary, and you calling people that offer their free-time to improve this project "unprofessional" or "not-serious" is - again - rude, and will only shun those away.

I tell my stories to power users, not to shy first day scripters.

Quote:
The snobbish approach of the moderators/coders there made very many people leave

You talk nonsense. I comment each script if nothing else just to say Thx which is something none of you do. Third time, when you go to any warez site and upload anything you wish (even open source program, not necesseraly hacked thing) you will get X thank you's, and messages of support because ppl appriciate your effort although they might have nothing of that. Not something I see here. This community is pretty selfish. PPl comment just things they use and need (not even that) and can't see further then their own simple needs.

So stop talking already and do some real work. My atitutde has nothing to do with AU3 mods attititutde. They don't like n00bs, I use this word to signify something else. I usualy help n00bs when my time allows and generaly don't have anything against them.
_________________
Back to top
View user's profile Send private message
Mr.Wolna/NRY
Guest





PostPosted: Mon Sep 22, 2008 1:06 pm    Post subject: Reply with quote

Hi first of all i will thank the authors for this great and wounderfull,amazing work, you did a very nice job, respect.


Days ago i have start to code something like a little AHK Addon for a forum, and i have a little problem with transparancy, first i thouth about to change the background color of the gifs(in the script) the same like the bakcground colour of my application. But the problem is, he did not show the same colour as i need. So i don't know what is all about, meaby its the DLL meaby the pallete. So meaby and i really hope so someone here can help me out my deilemma. Ahmm here a screenshot foor better understending, and sorry for my bad english Embarassed

Grettings Mr.Wolna
Back to top
Mr.Wolna/Again
Guest





PostPosted: Mon Sep 22, 2008 1:08 pm    Post subject: Reply with quote

Oh, i am very sorry folks. I forgot the screeny Embarassed



So long
Mr.Wolna
Back to top
Guest






PostPosted: Wed Sep 09, 2009 3:24 pm    Post subject: how to move (x,y) a GIF animation picture Reply with quote

I want to move the GIF animation like "GuiControl, Move,MYPICVAR, x10 y20 w200 h100".

I'am able to zoom but I can't move the GIFs whithout ControlID.
I want to add 2 buttons in "Control_AniGif.ahk" to move a picture like the zoom buttons.

please help
Back to top
Mr.Wolna/Again
Guest





PostPosted: Fri Nov 05, 2010 3:55 pm    Post subject: load local gif?? Reply with quote

Mr.Wolna/Again wrote:
Oh, i am very sorry folks. I forgot the screeny Embarassed




So long
Mr.Wolna



hello do you know how can I load local gif

IN TH E SCRIP
;-----8<----- For real use, just remove the part below before including the file ----------
; Run test code only if the file is ran standalone
If (A_ScriptName = "Control_AniGif.ahk")
{

IfNotExist %A_ScriptDir%\AniGIF.dll
{
URLDownloadToFile http://autohotkey.net/~PhiLho/AniGIF.dll, AniGIF.dll
URLDownloadToFile http://autohotkey.net/~PhiLho/Images/Flag_France.gif, Flag_France.gif
URLDownloadToFile http://autohotkey.net/~PhiLho/Images/pacman.gif, pacman.gif
URLDownloadToFile http://autohotkey.net/~PhiLho/Images/teleport.gif, teleport.gif
URLDownloadToFile http://autohotkey.net/~PhiLho/Images/Earth.gif, Earth.gif
}

Gui +LastFound
guiID := WinExist()

ISNTEAD URLDownloadToFile http://autohotkey.net/~PhiLho/Images/Flag_France.gif, Flag_France.gif

I want to use C:\image.gif, image.gif

somebody please help me


Wink
Back to top
BkkGuy
Guest





PostPosted: Tue Feb 08, 2011 2:36 am    Post subject: Reply with quote

Thanks so much for sharing this script, it has been a great help to me.

However, I have recently started using AHK_L Unicode with a larger AutoHotkeySC.bin file because I need to add Thai text to the gui, but when the script is compiled and the .exe is run it always returns a message saying "Error loading file" when it executes the SendMessage statement in the AniGif_LoadGifFromFile function, then it displays the Thai text but without the images.

The only changes I made to the original script were to add one line of Thai text to the gui and to replace the name of the pacman gif image to another gif image which resides in the script folder/directory.

There is no problem if the script is compiled using the AHK Basic version with the smaller AutoHotkeySC.bin file, but the Thai characters are replaced with meaningless ANSI characters.

So I can have either the images without proper Thai text, or Thai text with no images. Does anybody know of a solution to this problem? Any help would be greatly appreciated.
Back to top
aaronbewza



Joined: 20 Feb 2011
Posts: 399
Location: Cache Creek B.C.

PostPosted: Wed Mar 09, 2011 9:32 pm    Post subject: Reply with quote

I've been successful in making my animated gif work!
Thanks to PhiLho, bigtime. I have one problem though and I've asked on the help section but there have been no replies, I'm thinking because I asked for help incorrectly.
My problem is not making the gif animate, it is placing the working code into my existing GUI. I've tried placing it in many different places (at the beginning, right after the gui is created, at the middle, at the end) and I've tried using #FileInclude from my GUI and from the working gif code but nothing "marries" the two chunks of code so it works together.

I cannot, for the life of me, understand how to incorporate this into my existing GUI.

You will need these three files in the same dir to run this altered demo (credits and thanks to PhiLho):

hal.gif
AniGIF.dll
Control_AniGif.ahk

This is the image, named hal.gif:

...you need the AniGIF.dll file to be in your script dir, download here:
http://autohotkey.net/~PhiLho/AniGIF.dll
Here is the altered GUI code in which it works, THANK YOU PHILHO btw!!!:
(name it Control_AniGif.ahk)
Code:

/**
 * Control creation: you have to provide the ID of the GUI in which the control goes,
 * its position (_x, _y) and size (_w, _h) and optionally additional styles,
 * made of a string with keywords:
 * - autosize to make the control adapts to the Gif size
 * - center to center the Gif in the control
 * - hyperlink to allow clicking on the control and opening the URL defined later
 * Note that the required DLL is loaded automatically on first call.
 */
AniGif_CreateControl(_guiHwnd, _x, _y, _w, _h, _style="0")
{
   local hAniGif, agHwnd
   local msg, style
   static $bFirstCall := true

   If ($bFirstCall)
   {
      $bFirstCall := false
      ; It will be unloaded at script end
      hAniGif := DllCall("LoadLibrary", "Str", "AniGif.dll")
   }

   style := 0
   style := 0x50000000 | style

   ; http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/createwindowex.asp
   agHwnd := DLLCall("CreateWindowEx"
         , "UInt", 0                     ; Style, can be WS_EX_CLIENTEDGE = 0x200
         , "Str", "AniGIF"               ; Class Name
         , "Str", "AnimatedGif"          ; Window name
         , "UInt",  style                ; Window style
         , "Int", _x                     ; X position
         , "Int", _y                     ; Y position
         , "Int", _w                     ; Width
         , "Int", _h                     ; Height
         , "UInt", _guiHwnd              ; Handle of parent
         , "UInt", 0                     ; Menu
         , "UInt", 0               ; hInstance of the module registering the component's class
         , "UInt", 0)                    ; User defined style
   If (ErrorLevel != 0 or agHwnd = 0)
   {
      msg = %msg% Cannot create animated gif
      Gosub AniGif_CreateControl_CleanUp
      Return msg
   }

   Return agHwnd

AniGif_CreateControl_CleanUp:   ; In case of error
Return
}

/**
 * Function to call before exiting or destroying the GUI.
 */
AniGif_DestroyControl(_agHwnd)
{
   If (_agHwnd != 0)
   {
      AniGif_UnloadGif(_agHwnd)
      DllCall("DestroyWindow", "UInt", _agHwnd)
   }
}

;AniGIF control messages
; WM_USER := 0x400 ; 1024
; WAGM_BASE := WM_USER+1000 ; 2024

/**
 * After control creation, allows to load the indicated file.
 */
AniGif_LoadGifFromFile(_agHwnd, _gifFile)
{
   ; WAGM_LOADGIFFROMFILE EQU WAGM_BASE+0   ;wParam:N/A,      lParam:lpFileName
   SendMessage 2024, 0, &_gifFile, , ahk_id %_agHwnd%
}

AniGif_UnloadGif(_agHwnd)
{
   ; WAGM_UNLOADGIF EQU WAGM_BASE+2   ;wParam:N/A,      lParam:N/A
   SendMessage 2026, 0, 0, , ahk_id %_agHwnd%
}


 ; (comment from Aaron: I've tried removing this next part and adding to other GUI with no success)

;-----8<----- For real use, just remove the part below before including the file ----------
; Run test code only if the file is ran standalone
If (A_ScriptName = "Control_AniGif.ahk")
{

Gui +LastFound
guiID := WinExist()

hAniGif1 := AniGif_CreateControl(guiID, 5, 5, 90, 90)
hAniGif2 := AniGif_CreateControl(guiID, 892, 5, 90, 90)

If hAniGif1 is not integer
   MsgBox %hAniGif1%
If hAniGif2 is not integer
   MsgBox %hAniGif2%




    ;   this makes a working GUI for the gif

Gui Show, w987 h99, AniGif demo
Gui, Color, Red





;~ AniGif_LoadGifFromFile(hAniGif1, A_ScriptDir . "\hal.gif")
WideCharToMultiByte("hal.gif",sFileName)
AniGif_LoadGifFromFile(hAniGif1, sFileName)

;~ AniGif_LoadGifFromFile(hAniGif2, A_ScriptDir . "\hal.gif")
WideCharToMultiByte("hal.gif",sFileName)
AniGif_LoadGifFromFile(hAniGif2, sFileName)
Return

WideCharToMultiByte(wChar,Byref sChar) {
VarSetCapacity(sChar,StrLen(wChar)*2)
return DllCall("WideCharToMultiByte", "Uint", 0, "Uint", 0, "str", wChar, "int", -1, "str", sChar, "int", StrLen(wChar)*2, "Uint", 0, "Uint", 0)
}
}

Can I please have someone's help with this? It needs to go in my GUI called "Aaron's Super Google Search"
Thank you very much Smile
Aaron
_________________
You never get a third chance to make a second impression
Check out my scripts HERE.
Back to top
View user's profile Send private message Send e-mail
aaronbewza



Joined: 20 Feb 2011
Posts: 399
Location: Cache Creek B.C.

PostPosted: Wed Mar 09, 2011 10:07 pm    Post subject: Reply with quote

never mind I got it Smile
except.... I would like to be able to reference the AniGIF.dll file when the file is in a folder named "%temp%\aaron\welcome"
I've changed the paths in "Control_AniGif.ahk" to reflect the temp folder location but all it does is return an error. Am I forced to keep my animated GIF and the AniGIF.dll in the same location as my GUI? I wonder if this would count as a separate "help" request from my first one.
_________________
You never get a third chance to make a second impression
Check out my scripts HERE.
Back to top
View user's profile Send private message Send e-mail
tuna



Joined: 03 Oct 2007
Posts: 155
Location: UK

PostPosted: Sat Apr 02, 2011 10:33 am    Post subject: Reply with quote

For me, AniGif_LoadGifFromFile() fails - not too sure why. For the demo I just get

Code:
---------------------------
AniGIF
---------------------------
Error loading file.
---------------------------
OK   
---------------------------




I've checked all files are there.

Using Vista 32-bit with AHK_L Unicode. Thanks
Back to top
View user's profile Send private message
Guest






PostPosted: Sat Jul 02, 2011 10:34 am    Post subject: Reply with quote

I have this working in my gui, but is there anyway to position one animated gif in the center of the screen? I can use coordinates, but I need that it's stays on the center, no matter what screen res is used. Thanx.
Back to top
aaronbewza



Joined: 20 Feb 2011
Posts: 399
Location: Cache Creek B.C.

PostPosted: Sat Jul 02, 2011 11:14 am    Post subject: Reply with quote

I was looking for something similar, not for an animated gif but what was shown to me might work for you as well: Attach()
_________________
You never get a third chance to make a second impression
Check out my scripts HERE.
Back to top
View user's profile Send private message Send e-mail
Guest






PostPosted: Sat Jul 02, 2011 12:05 pm    Post subject: Reply with quote

Can you use guicontrol to move the picture?

After 3 hours in front of my computer, I've been able to place an animated gif in my gui! Now, the transparency doesn't work, and I can't figure out a way to place it centered on screen, just above the text string. Any help would be so much appreciated...


Code:

#SingleInstance, force

AniGif_CreateControl(_guiHwnd, _x, _y, _w, _h, _style="")
{
   local hAniGif, agHwnd
   local msg, style
   static $bFirstCall := true

   If ($bFirstCall)
   {
      $bFirstCall := false
      hAniGif := DllCall("LoadLibrary", "Str", "AniGif.dll")
   }

   style := 0
   
   style := 0x50000000 | style

   
   agHwnd := DLLCall("CreateWindowEx"
         , "UInt", 0                     ; Style, can be WS_EX_CLIENTEDGE = 0x200
         , "Str", "AniGIF"               ; Class Name
         , "Str", "AnimatedGif"          ; Window name
         , "UInt",  style                ; Window style
         , "Int", _x                     ; X position
         , "Int", _y                     ; Y position
         , "Int", _w                     ; Width
         , "Int", _h                     ; Height
         , "UInt", _guiHwnd              ; Handle of parent
         , "UInt", 0                     ; Menu
         , "UInt", 0               ; hInstance of the module registering the component's class
         , "UInt", 0)                    ; User defined style

   Return agHwnd

Return
}

AniGif_LoadGifFromFile(_agHwnd, _gifFile)
{
   ; WAGM_LOADGIFFROMFILE EQU WAGM_BASE+0   ;wParam:N/A,      lParam:lpFileName
   SendMessage 2024, 0, &_gifFile, , ahk_id %_agHwnd%
}

AniGif_UnloadGif(_agHwnd)
{
   ; WAGM_UNLOADGIF EQU WAGM_BASE+2   ;wParam:N/A,      lParam:N/A
   SendMessage 2026, 0, 0, , ahk_id %_agHwnd%
}

AniGif_SetBkColor(_agHwnd, _backColor)
{
   ; WAGM_SETBKCOLOR EQU WAGM_BASE+5   ;wParam:N/A,      lParam:BkColor
   PostMessage 2029, 0, _backColor, , ahk_id %_agHwnd%
}


Gui, 1: Margin, 0,0
Gui, 1: +LastFound

Gui, 1: Color, 303030
Gui, 1: +ToolWindow -Caption
Gui, 1: Show,x0 y0 w%A_ScreenWidth% h%A_ScreenHeight%

Gui, 2: default
Gui, 2: Color, 303030
Gui, 2: +ToolWindow -Caption
Gui, 2: font, s18 C707070 w700, verdana
Gui, 2: Add, Text, w700 center vremaining ,



guiID := WinExist()

hAniGif1 := AniGif_CreateControl(guiID, 1, 1, 100, 100)

AniGif_LoadGifFromFile(hAniGif1, "search-wait.gif")
AniGif_SetBkColor(hAniGif1, 0xefef)

;GuiControl, Move, MYPICVAR, x100 y200 ??????????


guicontrol,, remaining, Images remaining: %result%

Gui, 2: Show, xcenter ycenter

sleep 2000
exitapp
Back to top
Guest






PostPosted: Sat Jul 02, 2011 7:20 pm    Post subject: Reply with quote

This should work for centering the image, but it's not... Crying or Very sad

Code:

Gui +LastFound
guiID := WinExist()
SetFormat, Float, 0.0
xg = %A_ScreenWidth%
yg = %A_ScreenHeight%
xg2 := xg / 2
yg2 := yg / 2
;msgbox, %xg2%
;msgbox, %yg2%
hAniGif2 := AniGif_CreateControl(guiID, %xg2%, %yg2%, 100, 100)
Gui, +ToolWindow -Caption
Gui, Show,x0 y0 w%A_ScreenWidth% h%A_ScreenHeight%, AniGif demo
AniGif_LoadGifFromFile(hAniGif2, A_ScriptDir . "\search-wait.gif")
AniGif_SetBkColor(hAniGif2, 0xefefef)
Back to top
aaronbewza



Joined: 20 Feb 2011
Posts: 399
Location: Cache Creek B.C.

PostPosted: Sat Jul 02, 2011 9:25 pm    Post subject: Reply with quote

anigif will lose the gif's transparency so you have to match the background with the background of your gui. I had to do it for Aaron's Super Google (feel free to look at the code for ideas how to place the gifs and background color)
_________________
You never get a third chance to make a second impression
Check out my scripts HERE.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3, 4  Next
Page 3 of 4

 
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