Animated .GIF view

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Pantcho!.

Hello is ther any way to view animated gif in a reguler window?
for if i am doing an application with About box and in that box
i want to display animated .GIF not Icons that are being manually animated by diffrent icons.

can that be done?

thank you.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Berikco.

Most window animations are AVI files i think...like flying papers..
Anybody know this for sure?

Regards,

Benny

http://www.benny.zeb.be
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by PB.

> is ther any way to view animated gif in a reguler window?

Yes, see here:

viewtopic.php?t=2139


PB - Registered PureBasic Coder
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Justin.

If you can convert the gif to avi you could use the windows animate control via api calls.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Berikco.
Originally posted by Justin

If you can convert the gif to avi you could use the windows animate control via api calls.
Jasc Animation Shop does this.
Comes with Paint Shop Pro, very easy to do.

Regards,

Berikco

http://www.benny.zeb.be
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Pantcho!.

Thanks guys i will try it! :)

---
Registered Purebasic Member!
---
Resp'cta!
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Justin.

Here is an example of an animate control, displays a windows avi, you can change the ACM_OPEN message to load an avi from disk.

;Avi Animation
;http://msdn.microsoft.com/library/en-us ... mation.asp

sysdir$=space(255)
GetSystemDirectory_(@sysdir$,255)
If Right(sysdir$,1)"\" : sysdir$=sysdir$+"\" : EndIf

hshell=loadlibrary_(sysdir$ + "shell32.dll")

hwnd=openwindow(1,100,100,300,300,#PB_Window_SystemMenu,"Avi Animation")
creategadgetlist(hwnd)

hanim=CreateWindowEx_(0,"SysAnimate32","",#ACS_CENTER|#ACS_TRANSPARENT|#WS_CHILD|#WS_VISIBLE,10,10,70,70,hwnd,0,getmodulehandle_(0),0)

sendmessage_(hanim,#ACM_OPEN,hshell,150)

buttongadget(2,10,250,80,20,"Start")
buttongadget(3,200,250,80,20,"Stop")

disablegadget(3,1)

repeat
event=waitwindowevent()
if event=#PB_EventGadget
Select EventGadgetID()
case 2 ;Start
sendmessage_(hanim,#ACM_PLAY,-1,0|-1)
disablegadget(2,1)
disablegadget(3,0)

case 3 ;Stop
sendmessage_(hanim,#ACM_STOP,0,0)
disablegadget(2,0)
disablegadget(3,1)

endselect
endif
until event=#PB_EventCloseWindow

FreeLibrary_(hshell)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Berikco.
Originally posted by Berikco

Most window animations are AVI files i think...like flying papers..
Yes they are AVI's, Justin found out to :)

Code: Select all

h=LoadLibrary_("Shell32.dll") 
;
hwnd=OpenWindow(0,100,150,335,160,#PB_Window_SystemMenu,"Test")
If hwnd
  If CreateGadgetList(hwnd)
    ButtonGadget(1, 10, 100,  72, 20, "Search")
    ButtonGadget(2, 90, 100,  72, 20, "Search Doc")
    ButtonGadget(3, 170, 100,  72, 20, "Search Com")
    ButtonGadget(4, 250, 100,  72, 20, "File Cpy")
    ButtonGadget(5, 10, 128,  72, 20, "Copy File")
    ButtonGadget(6, 90, 128,  72, 20, "Delete File")
    ButtonGadget(7, 170, 128,  72, 20, "Empty Bin")
    ButtonGadget(8, 250, 128,  72, 20, "Kill File")
    AniWin=CreateWindowEx_(0,"SysAnimate32","",#ACS_AUTOPLAY|#ACS_CENTER|#ACS_TRANSPARENT|#WS_CHILD|#WS_VISIBLE|#WS_CLIPCHILDREN|#WS_CLIPSIBLINGS,10,10,280,100, hwnd,0,GetModuleHandle_(0),0)
  EndIf
EndIf
;
Repeat
  EventID = WaitWindowEvent()
  If EventID = #PB_EventGadget
    Select EventGadgetID()
    Case 1
      sendmessage_(AniWin,#ACM_OPEN,h,150) ;Search.avi
    Case 2
      sendmessage_(AniWin,#ACM_OPEN,h,151) ;SearchDoc.avi
    Case 3
      sendmessage_(AniWin,#ACM_OPEN,h,152) ;SearchCom.avi
    Case 4
      sendmessage_(AniWin,#ACM_OPEN,h,160) ;FilesCpy.avi
    Case 5
      sendmessage_(AniWin,#ACM_OPEN,h,161) ;FileCopy.avi
    Case 6
      sendmessage_(AniWin,#ACM_OPEN,h,162) ;FileDel.avi
    Case 7
      sendmessage_(AniWin,#ACM_OPEN,h,163) ;Search.avi
    Case 8
      sendmessage_(AniWin,#ACM_OPEN,h,164) ;FileKill.avi
   EndSelect
   RedrawWindow_(AniWin,0,0,#RDW_INVALIDATE | #RDW_ERASE)
  EndIf
Until  EventID=#PB_EventCloseWindow
FreeLibrary_(h)
End

Valid resource ID's for Shell32.dll AVI's are:
150, 151, 152, and 160 to 170
If you want to search more dll's for AVI's or Bitmaps,http://bome.com/Restorator/ is a fine tool for this.


Regards,

Berikco

http://www.benny.zeb.be
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Pantcho!.

How can i choose an specified AVI file from Hardisk?

---
Registered Purebasic Member!
---
Resp'cta!
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by WolfgangS.

Try OpenFileRequester()
Look into your PureBasic help system ... :wink:

MFG
WolfgangS
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Pantcho!.

i meant on your snippet u post now, where do i put avifile = "c:\test.avi"
??


---
Registered Purebasic Member!
---
Resp'cta!
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Justin.

I haven't tried it, but to load from disk remove all references to the loadlibrary_ function and replace the sendmessage with something like:

avi$="c:\yourpath\youravi.avi"
buffer=allocatememory(1,len(avi$)+1,0)
pokes(buffer,avi$)

sendmessage_(hanim,#ACM_OPEN,#null,@buffer)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Pupil.
Originally posted by Justin

I haven't tried it, but to load from disk remove all references to the loadlibrary_ function and replace the sendmessage with something like:

avi$="c:\yourpath\youravi.avi"
buffer=allocatememory(1,len(avi$)+1,0)
pokes(buffer,avi$)

sendmessage_(hanim,#ACM_OPEN,#null,@buffer)
i think that this is enough:
avi$="c:\yourpath\youravi.avi"
sendmessage_(hanim,#ACM_OPEN,#null,@avi$)

this work too i think:
sendmessage_(hanim,#ACM_OPEN,#null,@"c:\yourpath\youravi.avi")
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Berikco.

Only send pointer to filename in sendmessage.
Ofcourse to play AVI's from disk, you can also use the Movie() functions.

Code: Select all

;
hwnd=OpenWindow(0,10,15,500,400,#PB_Window_SystemMenu,"Test")
If hwnd
  AniWin=CreateWindowEx_(0,"SysAnimate32","",#ACS_AUTOPLAY|#ACS_CENTER|#ACS_TRANSPARENT|#WS_CHILD|#WS_VISIBLE|#WS_CLIPCHILDREN|#WS_CLIPSIBLINGS,50,0,250,360, hwnd,0,GetModuleHandle_(0),0)
  avi$="f:\purebasic\test.avi"
  sendmessage_(AniWin,#ACM_OPEN,0,@avi$) 
EndIf
;

Repeat
  EventID = WaitWindowEvent()
Until  EventID=#PB_EventCloseWindow
End





Regards,

Berikco

http://www.benny.zeb.be
Post Reply