Please explain a resource file

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

bluebird
Posts: 154
Joined: Wed Sep 28, 2016 3:55 am
DBs Used: DBF
Has thanked: 41 times
Been thanked: 7 times

Please explain a resource file

Post by bluebird » Thu Apr 05, 2018 4:02 am

Dear Mentors

Cold you please explain what a resource file is, what it is for, how to use.

I see some .rc files in the SAMLPES but my Adobe reader cannot open them.

Thanks, I will await an explanation

User avatar
dragancesu
Posts: 543
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia
Has thanked: 12 times
Been thanked: 97 times

Post by dragancesu » Thu Apr 05, 2018 6:54 am

HMG program can load images from a folder or be embedded in the program

See demo1.prg and demo2.prg/demo2.rc

Look at demo2.rc and you will see a list of what compiler should be added to the program
Test is: make compile demo1 and demo2, than erase .bmp files and run

p.s. .rc is a simple txt file

attach is now correct, please download again,
Attachments
rc.zip
(20.27 KiB) Downloaded 52 times

bluebird
Posts: 154
Joined: Wed Sep 28, 2016 3:55 am
DBs Used: DBF
Has thanked: 41 times
Been thanked: 7 times

Post by bluebird » Sat Apr 07, 2018 3:59 am

Thanks, I see how things work.

I noticed that the rc file on my pc looks like an adobe acrobat file. However you have to open it with notepad et.al.

bluebird
Posts: 154
Joined: Wed Sep 28, 2016 3:55 am
DBs Used: DBF
Has thanked: 41 times
Been thanked: 7 times

Post by bluebird » Tue Apr 10, 2018 7:31 pm

Sorry, I don't see how things work after all

If I create a file myapp.rc with
IMAGE1 BITMAP IMAGE1.BMP

How odes the build process know about the .rc file.

Also, Does the rc file have to have the same name as the application?

Lastly, what types of resouces can be included besides BMP files

Thanks

User avatar
esgici
Posts: 4441
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 329 times
Been thanked: 99 times
Contact:

Post by esgici » Tue Apr 10, 2018 7:57 pm

Please make a "search" before asking question
Search in forum.png
Search in forum.png (91.28 KiB) Viewed 522 times
search.php?keywords=resouce+file&terms= ... mit=Search

Viva HMG :D
Viva INTERNATIONAL HMG :D

bluebird
Posts: 154
Joined: Wed Sep 28, 2016 3:55 am
DBs Used: DBF
Has thanked: 41 times
Been thanked: 7 times

Post by bluebird » Wed Apr 11, 2018 6:00 pm

The examples have not helped

I create an rc file like myprog.rc , keeping it in the same folder as the myprog.prg file

containing a list of jpgs that I use in my program like

door jpg exitdoor.jpg
window jpg baywindow.jpg

then build the application again .

If I delete the jps and run the exe just built, the jpg images do not appear.

what am i doing wrong.

Thanks

edk
Posts: 307
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 85 times
Been thanked: 234 times

Post by edk » Wed Apr 11, 2018 6:22 pm

Do you refer to the jpg file name in the sources or to its resource name?
ex. PICTURE "door" or PICTURE "exitdoor.jpg" ?

Share piece of code with us.
Last edited by edk on Wed Apr 11, 2018 6:45 pm, edited 2 times in total.

User avatar
andyglezl
Posts: 945
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Has thanked: 16 times
Been thanked: 40 times
Contact:

Post by andyglezl » Wed Apr 11, 2018 6:39 pm

Sample...

// Using a resource file like this, you can include images,
// icons and sounds inside EXE.
//
// Resource name Resouce Type Resource FileName
// WAVERESNAME WAVE FILENAME.WAV
// Ejemplos:
//HMG JPG HMG.JPG
//imgBMP BITMAP img.BMP
//imgJPG JPG img.JPG
//imgGIF GIF img.GIF
//imgTIF TIF img.TIF
//imgPNG PNG img.PNG
//imgWMF WMF img.WMF
//imgICO ICO img.ICO
//imgCUR CUR img.CUR
Andrés González López
Desde Guadalajara, Jalisco. México.

bluebird
Posts: 154
Joined: Wed Sep 28, 2016 3:55 am
DBs Used: DBF
Has thanked: 41 times
Been thanked: 7 times

Post by bluebird » Wed Apr 11, 2018 8:08 pm

Thanks for all the patient replies but it ain't working for me. I have seen lots of examples in the forum and samples.

In my prg file there would be images referred to with the names like exitdoor.jpg and baywindow.jpg

The example. rc file would include: name, type, filename for each item, example of 2

door jpg exitdoor.jpg
window jpg baywindow.jpg

I used the same file name for the prg / hbp file and the resource file either in the same folder as the prg or in its own
sub-folder. Neither location worked.

I would then build the exe. How does the compiler know about and find the rc file? I don't know how.

It all sounds simple but some detail is missing in my knowledge of rc file use.

Thanks friends

edk
Posts: 307
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 85 times
Been thanked: 234 times

Post by edk » Wed Apr 11, 2018 9:28 pm

bluebird wrote:
Wed Apr 11, 2018 8:08 pm
In my prg file there would be images referred to with the names like exitdoor.jpg and baywindow.jpg
(...)
I would then build the exe. How does the compiler know about and find the rc file? I don't know how.
The compiler, when it finds a .rc file with the same name as .prg in the same folder, include the resources to the result file.
It is important to refer to the resource name in the sources, not to the jpg file.
Bez tytułu.jpg
Bez tytułu.jpg (136.64 KiB) Viewed 446 times
See an example from the attachment.
BUTTON_1.7z
(2.43 KiB) Downloaded 28 times
bluebird wrote:
Wed Apr 11, 2018 8:08 pm
The example. rc file would include: name, type, filename for each item, example of 2

door jpg exitdoor.jpg
window jpg baywindow.jpg
To check, is it jpg included into your .exe, just extract your .exe file (by 7-zip), and see folder: .rsrc\JPG, if doesn't exists "door" and "window" files, you do something wrong.

Post Reply