Page 1 of 1

Image Strategies

Posted: Fri Apr 08, 2016 11:21 am
by melliott42
Hello all,

It is good we can use a tool like "Resource Hacker" to change the icon of the .exe. My question is slightly different than this though.

Rather than having all the image files for my buttons and the like in individual .png files, how can I store them all in one file (a resource type file)? Is there an HMG preferred method\example to do this?

Thanks for your advice,

Michael

Re: Image Strategies

Posted: Fri Apr 08, 2016 11:29 am
by serge_girard
Michael,

You can edit the RC file and place this on top of it :

Code: Select all

1 VERSIONINFO
FILEVERSION     1,0,0,0
PRODUCTVERSION  1,0,0,0
BEGIN
  BLOCK "StringFileInfo"
  BEGIN
    BLOCK "080904E4"
    BEGIN
      VALUE "CompanyName", "YOUR NAME"
      VALUE "FileDescription", "HMG application"
      VALUE "FileVersion", "1.0"
      VALUE "InternalName", "HMG"
      VALUE "LegalCopyright", "YOUR NAME"
      VALUE "OriginalFilename", "HMG.EXE"
      VALUE "ProductName", "HMG"
      VALUE "ProductVersion", "1.0"
    END
  END

  BLOCK "VarFileInfo"
  BEGIN
    VALUE "Translation", 0x809, 1252
  END
END

PROJ			ICON		C:\HMG.3.0.44\***\proj.ico
Is this what you mean?

Serge

Re: Image Strategies

Posted: Fri Apr 08, 2016 11:35 am
by melliott42
I was thinking in terms of distribution to end users. Finding the best method to not have to do it having a bunch of individual image files. Putting them in a one resource type file but still being able to use them.

EDIT: I have been trying to move to use the IDE as my primary method to create HMG apps. Not sure if this is outside its scope.

Re: Image Strategies

Posted: Fri Apr 08, 2016 11:45 am
by serge_girard

Re: Image Strategies

Posted: Fri Apr 08, 2016 11:54 am
by melliott42
Serge that looks great.

Thanks!

Re: Image Strategies

Posted: Fri Apr 08, 2016 12:09 pm
by serge_girard
Thx to Claudio & Rathi !

Serge

Re: Image Strategies

Posted: Fri Apr 08, 2016 2:56 pm
by melliott42
Can this method be used with the IDE?

Seems each time I press the IDE Play button (to compile and run) it wipes out my .rc file. Also it purges anything from the .hbc file so I cant have it point to a custom .rc file.

What can you recommend?

Thanks.

Re: Image Strategies

Posted: Fri Apr 08, 2016 3:06 pm
by serge_girard
Michael,

What I do is:
In IDE close the project and edit RC file with another editor.
Then open project in IDE and check RC file.
S

Re: Image Strategies

Posted: Fri Apr 08, 2016 4:50 pm
by melliott42
Got it working - perfect! Thank you so much.

HMG is so much better than anything else out there. VB6 in its day was very easy too but that is 32-bit and no longer fully supported. .Net is a monstrosity of complexity and overkill.

Bravo HMG and its great user community!

Re: Image Strategies

Posted: Fri Apr 08, 2016 7:40 pm
by EduardoLuis
Hi Melliot42:

About icon of your appe, you can design yourself an save it on C:\HMG.3.4.2\RESOURCES folder, replacing existing one with the file name "Windows".- When you compile, your EXE will have your defined icon.-

About image files, perhaps i missunderstood what you want.-
If you define those that will be used on you app (EXE), you don't need to attach with your EXE anything.-
If you include each graphic on the RC file that refers (f. ex. "NUM_BOT JPG NUM_BOT.JPG" on each RC file Line) to a graphic you use in your appe (on your appe definition of image must be calle without specifyng the type - "NUM_BOT"), all graphics will be compilled inside your EXE.-

RC file is generated automatically when define your project. You must only go to RC tab and include line by line each reference name, it's type (BITMAP, JPG, PNG, etc.), and the name of graphic file (NUM_BOT JPG NUM_BOT.JPG).-
I use this method and works fine.-

Generally i use JPG and PNG files because they a less weight than BMP.-
I use BMP only for small a less weight graphics.-

Hoping this helps you.
With regards.
Eduardo