inject file(s) in executable

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

Hi all

My question : it is possible to "inject" somes files in my exe ? (same as delphi with ressources or others)

I try to join some files (dll, exe, jpg ...) in 1 exe and write files in a temp directory while exe running..

Thanks
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.
Hi all

My question : it is possible to "inject" somes files in my exe ? (same as delphi with ressources or others)

I try to join some files (dll, exe, jpg ...) in 1 exe and write files in a temp directory while exe running..

Thanks
You can always use the IncludeBinary command to include files in your exe and then write them back to disk when run.
Could look something like this:

Code: Select all

; write to disk
if CreateFile(0, "tmp\file.jpg")
  WriteData(?StartLabel, ?EndLabel-?StartLabel)
EndIf
 ... ; rest of code
End

; Included Data
StartLabel:
  IncludeBinary "image.jpg"
EndLabel:
Enjoy!



Edited by - Pupil on 03 August 2002 17:08:11
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 plopzz.

Hi

Thanks for this tip

I don't see that in the help file but, yes, in the online documentation i can find includebinary function...

btw, many thanks :)
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 plopzz
If you only want to save some stuff, like pictures, sound temporay to disk for later use in your pogram i.e. - you can include the stuff and grab then using:

Result = CatchSound(#Sound, MemoryAddress)
Result = CatchImage(#Image, MemoryAddress)
Result = CatchSprite(#Sprite, MemoryAddress, Mode)
Result = CatchJPEGSprite(#Sprite, MemoryAddress, JPEGLength, Mode)

Maybe this is what you looking for...!? ,-)


PIII450, 256MB Ram, 6GB HD, RivaTNT, DirectX8.1, SB AWE64, Win2000 + all Updates...

greetz
MrVainSCL! aka Thorsten
Post Reply