Page 1 of 2

Several icons in an EXE

Posted: Sat Nov 26, 2005 12:32 am
by Droopy
To have an EXE with severals icons
Create a Text file with RC extension and include it as Icon Resource type
You can use absolute or relative Path
Example :

Code: Select all

            ICONE1 ICON "1.ico"
            ICONE2 ICON "2.ico"
If you don't specify an icon in the compiler option, the first icon is used by default .

Posted: Sat Nov 26, 2005 9:34 am
by ts-soft
>> You can use absolute or relative Path
the PB-Ide doesn't found the Resource by relative Path, only jaPBe can do this.

Posted: Sat Nov 26, 2005 12:49 pm
by Droopy
You'r in the right :D

JAPBE can use absolute or relative Path
Example :
ICONE1 ICON "1.ico"
ICONE2 ICON "2.ico"
PB-IDE must use absolute path
Example :
ICONE1 ICON "D:\\1.ico"
ICONE2 ICON "D:\\2.ico"

Posted: Sat Nov 26, 2005 12:55 pm
by srod
Sorry for the stupid question :roll: , but how do you include a resource file in a PB project? This is something I've not required before.

Thanks.

Posted: Sat Nov 26, 2005 1:41 pm
by Droopy
JAPBE : Project Options / Resources tab
PB-IDE : Compiler Options / Resources tab

Posted: Sat Nov 26, 2005 1:53 pm
by srod
Doh!

I think this combined with your other recent post in this section will prove very useful.

Thank you.

Posted: Sat Nov 26, 2005 3:14 pm
by NoahPhense
So does this mean that we can use a .rc file to contain the file information?

- np

Posted: Sat Nov 26, 2005 3:22 pm
by Droopy

Code: Select all

ICONE1 ICON "D:\\1.ico" 
ICONE2 ICON "D:\\2.ico"
is a content of an RC file

Posted: Sat Nov 26, 2005 3:44 pm
by ts-soft
NoahPhense wrote:So does this mean that we can use a .rc file to contain the file information?

- np
for example, you can use this:

Code: Select all

1 VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_APP
{
  BLOCK "StringFileInfo"
  {
    BLOCK "040704b0"
    {
      VALUE "ProductName", "Myprogram.exe\0"
      VALUE "ProductVersion", "1.0\0"
      VALUE "FileVersion", "1.0.0.1\0"
      VALUE "FileDescription", "\0"
      VALUE "InternalName", "Myprogram.exe\0"
      VALUE "OriginalFilename", "Myprogram.exe\0"
      VALUE "LegalCopyright", "© 2005 by NoahPhense\0"
    }
  }
  BLOCK "VarFileInfo"
  {
    VALUE "Translation", 0x0407, 0x4b0
  }
}
you can also added icons and other resources

Posted: Fri Aug 25, 2006 7:11 pm
by Armoured
Hi
I want to add a version resource from the command line to a program. First I have made a file called "version.rc" with the text of NoaPhense:

Code: Select all

1 VERSIONINFO 
FILEVERSION 1,0,0,1 
PRODUCTVERSION 1,0,0,1 
FILEOS VOS_NT_WINDOWS32 
FILETYPE VFT_APP 
{ 
  BLOCK "StringFileInfo" 
  { 
    BLOCK "040704b0" 
    { 
      VALUE "ProductName", "Myprogram.exe\0" 
      VALUE "ProductVersion", "1.0\0" 
      VALUE "FileVersion", "1.0.0.1\0" 
      VALUE "FileDescription", "\0" 
      VALUE "InternalName", "Myprogram.exe\0" 
      VALUE "OriginalFilename", "Myprogram.exe\0" 
      VALUE "LegalCopyright", "© 2005 by NoahPhense\0" 
    } 
  } 
  BLOCK "VarFileInfo" 
  { 
    VALUE "Translation", 0x0407, 0x4b0 
  } 
}
And finally I have used the compiler from the command line with the option /resource "c:version.rc" but I have this error:

Polink fatal error file not found "PureBasic.res" :cry:

Why?

Posted: Fri Aug 25, 2006 7:28 pm
by ts-soft
Use a batchfile like this:
"D:\Programmieren\PureBasic4\Compilers\porc.exe" "Version.rc" ; change Path
In your Application import the compiled Resource like:

Code: Select all

Import "Version.res" : EndImport
I hope this info is useful for you

Posted: Sat Aug 26, 2006 10:00 am
by Armoured
Hi ts-soft and thanks for your help :)

Posted: Mon Oct 02, 2006 7:22 pm
by chen
Resources files are only for Windows... in accordance to the manual
Since Resources are a specific to the Windows platform only, PB does not include a Library to manage them and they are not further documented here. See documentation on the Windows API and resources for more information.
Then, for people working in cross-platform (or thinking on) is not. :wink:

Re: Several icons in an EXE

Posted: Fri Jan 22, 2010 7:27 pm
by Michael Vogel
Some of my programs have more than one icon in it's exe file -- it's not easy to keep such IDE projects portable (on my USB stick), because all icon files need an absolute path :cry:...

So this is a kind of feature request or, at least, a poll which possibilities would allow an easier management for resources. So what kind of improvements could be done, let's start...
• the IDE should allow to add more than only one icon (the best way, fred have to do the job)
• a selfmade tool plays a kind of preprocessor (see below) and adapt pathes, if necessary (slows done each compilation)
• any other ideas?

Michael


___
Principle of Portable-RC.pb
- read source file
- check, if "; AddResource" is present
- <NO>: quit
- <YES>: read resource file, replace vars like %SOURCEPATH% by real values, save backup of original text in a comment line

Re: Several icons in an EXE

Posted: Fri Jan 22, 2010 7:54 pm
by ts-soft
Michael Vogel wrote: • any other ideas?
create a "myresource.res" with porc from your script and import this!