Including images into exe

Everything else that doesn't fall into one of the other PB categories.
Codemonger
Enthusiast
Enthusiast
Posts: 384
Joined: Sat May 24, 2003 8:02 pm
Location: Canada
Contact:

Including images into exe

Post by Codemonger »

Ok I would like to include binary images into the exe, that is not a problem.

The question is are the purebasic commands for including binary files compatible with windows resource commands ? are the same or similar ?
I haven't searched the forum yet on this particular topic, so I'll do that in the meantime. Anyway just want to know If I could load a resource from a file using purebasics include binary commands.
<br>"I deliver Justice, not Mercy"

    - Codemonger, 2004 A.D.
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Post by GPI »

Only with additional Tools, like ResHacker (see jaPBe). But when you use ResHacker, than you must (!) add a icon to the exe, or you get only corrupted Exes.
Codemonger
Enthusiast
Enthusiast
Posts: 384
Joined: Sat May 24, 2003 8:02 pm
Location: Canada
Contact:

Post by Codemonger »

Thanks GPI, I didn't even know the source of your editor is available .. what license do you have if I wan't to use your source codeto JaPBe, or modify it ?
<br>"I deliver Justice, not Mercy"

    - Codemonger, 2004 A.D.
Seldon
Enthusiast
Enthusiast
Posts: 405
Joined: Fri Aug 22, 2003 7:12 am
Location: Italia

Post by Seldon »

Include-Binary commands don't work for Windows resources. Actually resources are a better way to include files as the memory is used since you load them and they can be freed when if you don't need them anymore.
But as GPI said you can add a compiled resource using ResHacker. To access a resource you must use the Win-API, but it's very easy (I posted some code in Tricks 'n' Tips section). Actually I hope Fred will support the option to add a .RES file to your EXEs by the PBCompilter (it can be done very quickly). The way I'd suggest is this:

1) You put your own .RES in the same directory with the same name of your PB source, ex:
MySource.pb -> MySource.RES

2)PBCompilter will look if there is a .RES file with the same name of the source. Does it exist ?
If yes:
- forget the icon option (as the linker can't accept 2 .RES file)
- pass it to linker to build the final EXE
if no:
- user wants the icon ? ok, add it
- like before...

If you want the icon and your own .RES, you have just to include the icon in your .RES (you must only pay attention and give it the same number PB uses to load it in the window border).
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Good idea

Post by thefool »

I think your ide, seldon is very good!
Or else a possibility would be to have an tag like
;addresfile: test.res
or something like that
Codemonger
Enthusiast
Enthusiast
Posts: 384
Joined: Sat May 24, 2003 8:02 pm
Location: Canada
Contact:

Post by Codemonger »

Thanks guys, your ideas are very much appreciated. And it looks like it will work for what I want it for.
<br>"I deliver Justice, not Mercy"

    - Codemonger, 2004 A.D.
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Post by GPI »

Codemonger wrote:Thanks GPI, I didn't even know the source of your editor is available .. what license do you have if I wan't to use your source codeto JaPBe, or modify it ?
What exact do you want: Create your own mutant of japbe? When you don't give this version to others: No problems.

When you want to translate jaPBe for other languages (I know, that somebody change jaPBe so, that it works with DarkBasic). Also no problem, BUT i want to know this and i want to see a preview-version before i give my ok.
Post Reply