IncludeBinary and AVI

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 Jon.

Ok I found this code elswhere in the forums and am having trouble with it! I want to know what I am doing wrong with the includebinary part of the code cos it don't work ?? Cheers, Jon.



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)
sendmessage_(AniWin,#ACM_OPEN,0,?myavi)
EndIf
;

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

myavi:
includebinary "blah.avi"
return
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 MrVainSCL.

Hi Jon,
havent seen the source to include and catch an avi before... I hope the AVI is not so big... else it would be bad to have the complete avi in memory (also loaded with the exe into memory)... If the avi is big, it would make more sence to load and play it direct from disk i think.

If you only want to play an avi in a window, you can always use the MovieLib, take a look to the movie.pb included in pure package.

greetz
MrVainSCL! aka Thorsten

PIII450, 256MB Ram, 80GB HD + 6,4 GB, RivaTNT, DirectX9.0, SB AWE64, Win2000 + all Updates...
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 Jon.

MrVain the avi is a converted AnimatedGif so it's really small. I tried to include the gif and use it in a webgadget but I cloudn't get that to work either. Both Avi and Gif work fine loading from disk but wont work when I use includebinary.

Anyway My objective is simply to get an animation which started out as An animated gif to be included in an exe then displayed when the exe has run :)

Any ideas would be really appreciated.

Cheers, Jon.
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 MrVainSCL.

HI Jon,
here is a small example how to use included AVI and save it temp to hd, load then and play inside a window... Hope it will help you... I am sure there is any way to catch the AVI direct from memory if you know stuctures of MovieLib!?

Code: Select all

; ------------------------------------------------------------
;
; PureBasic  - Load´n play included AVI - Example v1.0
;
; by MrVainSCL! aka Thorsten   02/Feb/2003    PB v3.51+
;
; ------------------------------------------------------------
;
    If InitMovie() = 0
      MessageRequester("Error", "Can't initialize movie playback", 0) 
      End
    EndIf
    ;
    ; -------- Save included AVI temp to HD --------
    ;
    OpenFile(0,"c:\temp.avi")
      WriteData(?Inc_AviStart,?Inc_AviEnd-?Inc_AviStart)
    CloseFile(0)
    ;
    ; -------- Load temp saved API --------
    ;
    If LoadMovie(0,"c:\temp.avi") = 0
      MessageRequester("Error", "Can't load AVI", 0) 
      End
    EndIf
    ;
    ; -------- Open Window and play AVI --------
    ;
    hwnd = OpenWindow(0,10,15,500,400,#PB_Window_SystemMenu,"Test")
    ;
    PlayMovie(0, WindowID())
    ;
    ; -------- MainLoop --------    
    ;
    Repeat
      EventID = WaitWindowEvent()
    Until EventID = #PB_EventCloseWindow
    ;
    ; -------- When exit program we will delete temp file --------
    ; 
    DeleteFile("c:\temp.avi")
End
;
; ---------------------------------------------------------------------
; DATA SECTION
; ---------------------------------------------------------------------
;
    Inc_AviStart:
        IncludeBinary "test.avi"
    Inc_AviEnd:
;
; ---------------------------------------------------------------------

greetz
MrVainSCL! aka Thorsten

PIII450, 256MB Ram, 80GB HD + 6,4 GB, RivaTNT, DirectX9.0, SB AWE64, Win2000 + all Updates...
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.

Jon, you can't use #ACM_OPEN with includebinary, that message needs to load the avi as a resource, not supported yet by PB.
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 Jon.

Thanks MrVainSCL (What does your nickname stand for anyway?) I thought I might have to end up doing it that way :( a bit untidy bit hey I'm the only one that's going to know :)

Justin - Thanks for the #ACM_OPEN information :) every little bit helps.

Sweet As!
Jon (Falling into the PB Groove)
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 MrVainSCL.

no problem Jon :wink: My nickname "MrVainSCL" or "MrVain^SCL!" stands for "Mr.Vain of Secretly!"! Take a look to the unfinished site http://www.secretly.de - Happy coding :wink:

greetz
MrVainSCL! aka Thorsten

PIII450, 256MB Ram, 80GB HD + 6,4 GB, RivaTNT, DirectX9.0, SB AWE64, Win2000 + all Updates...
Post Reply