Please explain a resource file

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

bluebird
Posts: 172
Joined: Wed Sep 28, 2016 3:55 am
DBs Used: DBF

Please explain a resource file

Post by bluebird »

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: 920
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia

Re: Please explain a resource file

Post by dragancesu »

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 212 times
bluebird
Posts: 172
Joined: Wed Sep 28, 2016 3:55 am
DBs Used: DBF

Re: Please explain a resource file

Post by bluebird »

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: 172
Joined: Wed Sep 28, 2016 3:55 am
DBs Used: DBF

Re: Please explain a resource file

Post by bluebird »

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: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Please explain a resource file

Post by esgici »

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

Viva HMG :D
Viva INTERNATIONAL HMG :D
bluebird
Posts: 172
Joined: Wed Sep 28, 2016 3:55 am
DBs Used: DBF

Re: Please explain a resource file

Post by bluebird »

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: 909
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: Please explain a resource file

Post by edk »

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: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: Please explain a resource file

Post by andyglezl »

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: 172
Joined: Wed Sep 28, 2016 3:55 am
DBs Used: DBF

Re: Please explain a resource file

Post by bluebird »

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: 909
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: Please explain a resource file

Post by edk »

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 4008 times
See an example from the attachment.
BUTTON_1.7z
(2.43 KiB) Downloaded 178 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