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 

Add an AVI to your AHK Gui - CreateWindow_AVI.ahk [LIB]
Goto page Previous  1, 2, 3, 4, 5  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
daonlyfreez



Joined: 16 Mar 2005
Posts: 745
Location: Berlin

PostPosted: Tue Oct 24, 2006 5:04 pm    Post subject: Reply with quote

Thanks again PhiLho, updated code.

Edit:
Quote:
Pointer to a buffer that contains the path of the AVI file


Could you show me how to do this? Load an AVI file instead?
_________________
(sorry, homesite offline atm)
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
PhiLho



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

PostPosted: Tue Oct 24, 2006 6:13 pm    Post subject: Reply with quote

daonlyfreez wrote:
Could you show me how to do this? Load an AVI file instead?
I try, but I can't get it work. I don't know if it is because I don't have right AVI file format, right system or right code...
Googling for ACM_OPEN SysAnimate32 gives a surprisingly low number of hits. I saw some implementations for various Basics, but I can't get them to work.
I added 000 - File to the list, and changed the code as follow:
Code:
GuiAddResAni(mainGuiHandle, aniInstance, aniNr, posx, posy, posw, posh)
{
  global aniCtlHandle, ACM_PLAY, ACM_STOP

  WS_CHILD        = 0x40000000
  WS_VISIBLE      = 0x10000000
  ACS_AUTOPLAY    = 0x0004
  ACS_TRANSPARENT = 0x0002
  ACS_CENTER      = 0x0001
  ACM_OPEN       := 0x400 + 100
  ACM_PLAY       := 0x400 + 101
  ACM_STOP       := 0x400 + 102
  GWL_HINSTANCE := -6

  hInstance := DllCall("GetWindowLong"
      , "UInt", mainGuiHandle
      , "Int", GWL_HINSTANCE)

  aniCtlHandle := DLLCall("CreateWindowEx"
        , uint, 0                 ; Style
        , str, "SysAnimate32"     ; Class Name
        , uint, 0                 ; Window name
        , uint, WS_CHILD|WS_VISIBLE|ACS_TRANSPARENT|ACS_CENTER|ACS_AUTOPLAY ; window style
        , int, posx               ; Left
        , int, posy               ; Top
        , int, posw               ; Right
        , int, posh               ; Bottom
        , uint, mainGuiHandle     ; Handle of parent
        , int, 0                  ; Menu
        , uint, hInstance         ; hInstance
        , uint, 0)                ; User defined style

  ; http://msdn.microsoft.com/library/en-us/shellcc/platform/commctls/animation/messages/acm_open.asp
  ; wParam: Instance handle to the module from which the resource should be loaded.
  ;   Note that if the window is created by a DLL, the default value for hinst is the HINSTANCE value of the DLL, not of the application that calls the DLL.
  ; lParam: Pointer to a buffer that contains the path of the AVI file or the name of an AVI resource.
  ;   Alternatively, this parameter can consist of the AVI resource identifier in the low-order word and zero in the high-order word.
  If (aniNr != 0)
  {
    PostMessage, %ACM_OPEN%, %aniInstance%, %aniNr%, , ahk_id %aniCtlHandle%
  }
  Else
  {
    avi := A_WinDir . "\clock.avi"
    avi := A_ScriptDir . "\torch.avi"
    r := DllCall("SendMessageA"
        , "UInt", aniCtlHandle
        , "UInt", ACM_OPEN
        , "UInt", 0
        , "UInt", &avi)
  MsgBox (%ErrorLevel%) %r% %avi%
  }
}
but r is always 0. Also tried SendMessageW, of course, hence the DllCall.
If you can get something out of that...
Oh, BTW, I found out how to get the hInstance value...
_________________
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
SKAN



Joined: 26 Dec 2005
Posts: 6084

PostPosted: Tue Oct 24, 2006 6:33 pm    Post subject: Reply with quote

PhiLho wrote:
I found out how to get the hInstance value...


Thanks! Very Happy
_________________
Back to top
View user's profile Send private message
not-logged-in-youknowwho
Guest





PostPosted: Tue Oct 24, 2006 7:06 pm    Post subject: Reply with quote

Hey Very Happy

That works! It does... make sure the path to your avi is right
Back to top
n-l-i-d
Guest





PostPosted: Tue Oct 24, 2006 7:11 pm    Post subject: Reply with quote

It works for me:



SysAnimate32 cannot do sound, so I guess this is the max, but nice! Cool
Back to top
daonlyfreez



Joined: 16 Mar 2005
Posts: 745
Location: Berlin

PostPosted: Tue Oct 24, 2006 8:37 pm    Post subject: Reply with quote

I found some more AVI resources (on my XP SP2, you might have them too)

msgina.dll
2413 - Control + Alt + Delete

syncui.dll
133 - Sync
134 - Compare

wiadefui.dll
1000 - Camera connect
1001 - Scanner connect
1002 - Camcorder connect
1003 - Camcorder copy
1004 - Scanner copy
1005 - Camera copy
1006 - Camera and scanner connect

xpsp2.dll
140 - Search flashlight
160 - Network connect
_________________
(sorry, homesite offline atm)
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Thalon



Joined: 12 Jul 2005
Posts: 640

PostPosted: Wed Oct 25, 2006 10:49 am    Post subject: Reply with quote

Wonderful scripts here around Smile

I wonder what will come next! (video-cut?).

Smile

Thalon
_________________
AHK-Icon-Changer
AHK-IRC
deutsches Forum
SacredVault
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 6084

PostPosted: Wed Oct 25, 2006 11:16 am    Post subject: Reply with quote

Animated GIF ?!!
_________________
Back to top
View user's profile Send private message
PhiLho



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

PostPosted: Wed Oct 25, 2006 2:39 pm    Post subject: Reply with quote

Hey, it works with clock.avi!
At some point, it didn't worked, I probably hacked more the code and tested with other AVI files, but didn't tested the latest version with clock.avi...

I guess that the other test files have some sound in it, since the control rejects them.
Curiously, two of them was made by a trial shareware that transforms animated Gifs to AVI. But perhaps it creates an AVI with a silent sound track... It isn't a very good program anyway.
Do you know where we can find some other AVI files that would work with this component? Or how to generate them properly? When searching for AVI on Google, I find mostly methods to rip DVDs...

Anyway, I am happy I gave my work in progress, I knew it was useful. Very Happy
_________________
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
SKAN



Joined: 26 Dec 2005
Posts: 6084

PostPosted: Wed Oct 25, 2006 3:04 pm    Post subject: Reply with quote

n-l-i-d wrote:
It works for me:





Why does the Clock looks cropped? Clock.avi runs @ full size in my Divx Player!

Question
_________________
Back to top
View user's profile Send private message
PhiLho



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

PostPosted: Wed Oct 25, 2006 3:08 pm    Post subject: Reply with quote

Code:
    ; Add control
    posx = 220
    posy = 60
    posw = 300
    posh = 80
Should be adjusted to real size. I suppose daonlyfreez used the max of the sizes he found in shell32.dll.
_________________
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
not-logged-in-daonlyfreez
Guest





PostPosted: Wed Oct 25, 2006 3:09 pm    Post subject: Reply with quote

@Goyyah: That is because I didn't adapt the size of the control before testing.

Ah, PhiLho just answered...
Back to top
SKAN



Joined: 26 Dec 2005
Posts: 6084

PostPosted: Wed Oct 25, 2006 3:12 pm    Post subject: Reply with quote

Thanks for the clarification PhiLho / daonlyfreez!

I was under wrong impression that the control would act like a picture!

Smile

Edit: A picture control resizes the image to fit instead of cropping!
_________________
Back to top
View user's profile Send private message
PhiLho



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

PostPosted: Wed Oct 25, 2006 4:14 pm    Post subject: Reply with quote

Goyyah, controls managed by AutoHotkey auto-size (and auto-place) because Chris coded them like that... He wrote wrappers around crude WinAPI functions, to help their use and avoid lot of sweat.
He did a fine job, he has a very good GUI system, that I like to use.
Now, here we are dealing with these crude WinAPI calls, no wrapper, so we must sweat to get them fine... Wink
I don't know if there is a simple way to ask an AVI which size it is.
_________________
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
SKAN



Joined: 26 Dec 2005
Posts: 6084

PostPosted: Wed Oct 25, 2006 10:10 pm    Post subject: Reply with quote

That for all the information! Very Happy

PhiLho wrote:
I don't know if there is a simple way to ask an AVI which size it is.


What would be the hard way? Read the file header with Binary routines? Rolling Eyes
_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3, 4, 5  Next
Page 2 of 5

 
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