How to Include bitmaps/icons in an EXE?

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
karweru
Posts: 220
Joined: Fri Aug 01, 2008 1:51 pm
DBs Used: DBF,mysql,mariadb,postgresql,sqlite,odbc
Contact:

How to Include bitmaps/icons in an EXE?

Post by karweru »

Happy new year everyone,

The executable i'm producing doesn't display bitmaps/icons in the toolbar when i copy the executable into another folder or other computer. The bitmaps & icons i'm using are listed in the resources tab of the IDE, and show properly when I run from the project folder. My desire is to supply only one executable file.

I suspect i'm missing something, or is it that you have to supply the bitmaps/icon files together with the executable for it to work properly?

I'm using hmg3.

I would really appreciate some guidance please.
Kind regards,
Gilbert.
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: How to Include bitmaps/icons in an EXE?

Post by Rathinagiri »

Had you properly referenced with the reference name inside the control picture clause?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
Czarny_Pijar
Posts: 172
Joined: Thu Mar 18, 2010 11:31 pm
Location: 19.2341 E 50.2267 N

Re: How to Include bitmaps/icons in an EXE?

Post by Czarny_Pijar »

Looks like the easiest way to accomplish this task is to substitute the file c:\hmg35\RESOURCES\window.ico to another one of your choice.
User avatar
karweru
Posts: 220
Joined: Fri Aug 01, 2008 1:51 pm
DBs Used: DBF,mysql,mariadb,postgresql,sqlite,odbc
Contact:

Re: How to Include bitmaps/icons in an EXE?

Post by karweru »

Thank you Rathi, cZarny,

I have made some further tests using samples\main.demo. Please compile it and copy the executable to another folder. When you run it from the ..\samples\main.demo folder, the printer and folder-open buttons show properly. When you run the executable in the other directory, the button images disappear. I hope this illustratrates my problem much better.
Kind regards,
Gilbert.
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: How to Include bitmaps/icons in an EXE?

Post by Rathinagiri »

That is because the resource definition of main.demo doesn't include any image except demo.ico, br_no, br_ok.

All other images are specified by their file names! For instance, line no. 531

Code: Select all

PICTURE 'Demo.gif'
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
karweru
Posts: 220
Joined: Fri Aug 01, 2008 1:51 pm
DBs Used: DBF,mysql,mariadb,postgresql,sqlite,odbc
Contact:

Re: How to Include bitmaps/icons in an EXE?

Post by karweru »

Dear Rathi,

Thanks for your response and patience.

I have edited the main demo resource file from the IDE to read as follows;

Code: Select all

br_no BITMAP br_no.bmp
br_ok	BITMAP br_ok.bmp
demo	ICON	demo.ico
open  BITMAP open.bmp
print  BITMAP button.bmp
I'm still getting the same result.
Kind regards,
Gilbert.
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: How to Include bitmaps/icons in an EXE?

Post by Rathinagiri »

Had you changed the reference in prg files too?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
karweru
Posts: 220
Joined: Fri Aug 01, 2008 1:51 pm
DBs Used: DBF,mysql,mariadb,postgresql,sqlite,odbc
Contact:

Re: How to Include bitmaps/icons in an EXE?

Post by karweru »

No Rathi, I haven't changed anything else...
Kind regards,
Gilbert.
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: How to Include bitmaps/icons in an EXE?

Post by Rathinagiri »

That is the problem!

You have to specify the image reference only and not the filename in the .prg file.

Change #line 180 to

Code: Select all

			PICTURE 'print'
Like this, you have to refer the label given in resource file inside the prg file.

In your case, the exe file includes the resources, but since you refer the original filename, it searches for the file.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
mol
Posts: 3825
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: How to Include bitmaps/icons in an EXE?

Post by mol »

Try to use uppercase letters. I think it should help you...
Marek
Post Reply