include an animated gif in an exe?

Just starting out? Need help? Post your questions and find answers here.
nessie
User
User
Posts: 60
Joined: Mon Jul 07, 2003 1:19 pm
Location: Glasgow / Scotland
Contact:

include an animated gif in an exe?

Post by nessie »

Does anyine know how to include an animated gif into the exe?. At the moment i'm using a web gadget and loading the gif from disk, but it would make it easier to be able to distribute a single exe.
mskuma
Enthusiast
Enthusiast
Posts: 573
Joined: Sat Dec 03, 2005 1:31 am
Location: Australia

Post by mskuma »

You could do an includebinary in a DataSection, something like:

Code: Select all

DataSection 
  TheGif: 
    IncludeBinary "file.gif" 
EndDataSection
The would bind the GIF (or any other binary) to the EXE. However I think GIF is not natively supported in PB for patent reasons. Does it have to be a GIF. How about a PNG - then you can do the above and a catchimage to use the image in your code. [edit: whoops - I see you want animated.. sorry - oh well maybe you can use AnimSprite in a 3rd party lib -do a search to find which one - I think Droopy's or PBOSL].
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

The .gif format has no more licensing problems since quite a while. What I would do is download El_Choni's ImageOleDecoder from PureArea.net and install it. This will be easy if you're using 3.94 and a bit more difficult if you're using 4.0, the reason being you'll have to compile it. It's not that hard, it's just that you'll have a few hoops to jump through, including downloading lccwin32 from the publisher site. Full instructions are supplied. I have done this a couple times now, and it's quite doable, although a bit daunting. I'd be happy to post a link to the compiled lib and you could put it in your \userlibraries folder and use the other parts of the download for your licensing info, help .chm, etc. but I don't know if that would be alright with El_Choni or not. Anyway, that lib will decode .gifs and you can just IncludeBinary and carry on.
Last edited by netmaestro on Fri Aug 18, 2006 6:52 am, edited 1 time in total.
BERESHEIT
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

Ack I'm a retard. I didn't see the animated part either! Ok, here's a way you can do it:

You need this to test: http://www.networkmaestro.com/fish.gif

Then try this code out:

Code: Select all

If CreateFile(0,"fish.gif")
  WriteData(0, ?gif, ?endgif-?gif)
  CloseFile(0)
Else
  MessageRequester("OOPS!","Could not create .gif file")
EndIf

OpenWindow(0,0,0,320,240,"Animated .gif Test",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
CreateGadgetList(WindowID(0))
gif$=GetCurrentDirectory()+"\fish.gif" ; full path is necessary
url$="about:<html><body scroll='no' leftmargin='0' topmargin='0'><img src='"+gif$+"'></img></body></html>"
WebGadget(0,50,50,90,120,url$)
Repeat
ev=WaitWindowEvent()
Until ev=#PB_Event_CloseWindow

DataSection
  gif: IncludeBinary "d:\network maestro\fish.gif" ; <----change this to your location
  endgif:
EndDataSection
Based (a bit loosely) on forum code posted by Sparkie here:

http://www.purebasic.fr/english/viewtopic.php?t=13855

and PB here:

http://www.purebasic.fr/english/viewtopic.php?t=3817
BERESHEIT
nessie
User
User
Posts: 60
Joined: Mon Jul 07, 2003 1:19 pm
Location: Glasgow / Scotland
Contact:

Post by nessie »

netmaestro, as always, you are a star. I couldn't figure out how to do this. Thanks very much !! :D
User avatar
bingo
Enthusiast
Enthusiast
Posts: 210
Joined: Fri Apr 02, 2004 12:21 pm
Location: germany/thueringen
Contact:

Post by bingo »

["1:0>1"]
Post Reply