WINDOWS issue : How do you include icons into the exe ?
WINDOWS issue : How do you include icons into the exe ?
I know how to include data in a compiled program using IncludeBinary() and CatchImage()
but that does not make the icon visible so that you can assign specific icons to specific filetypes.
I think that can only be done using a resource script.
I would be grateful if someone could provide a complete working (but simple) example to srudy and learn from.
but that does not make the icon visible so that you can assign specific icons to specific filetypes.
I think that can only be done using a resource script.
I would be grateful if someone could provide a complete working (but simple) example to srudy and learn from.
PB Forums : Proof positive that 2 heads (or more...) are better than one 

Re: WINDOWS issue : How do you include icons into the exe ?
Open some file in the "Resource Hacker" program and select "Save group to *rc file" from the menu. You will have icons and an rc file. Next, you disable the icon in the compiler settings, and add an rc file in the resources tab. Compile the program and view the icons using the Resource Hacker program.
There may be an error in the section "LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL", so delete this line and leave the following text:
where 1 and 2 are the icon number/name, and ICON1_1.ico is the file name.
There may be an error in the section "LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL", so delete this line and leave the following text:
Code: Select all
1 ICON "ICON1_1.ico"
2 ICON "ICON1_2.ico"
Re: WINDOWS issue : How do you include icons into the exe ?
You hae to assign the icon like this ... : https://www.purebasic.fr/english/viewtopic.php?t=34543Blue wrote: Sun Mar 31, 2024 5:39 pm I know how to include data in a compiled program using IncludeBinary() and CatchImage()
but that does not make the icon visible so that you can assign specific icons to specific filetypes.
I think that can only be done using a resource script.
I would be grateful if someone could provide a complete working (but simple) example to srudy and learn from.
Re: WINDOWS issue : How do you include icons into the exe ?
Thank you AZJIO and Bisonte for taking the time to reply.
(I was not ignoring you or this topic, i was simply under the weather for the past days.)
I'll study your suggestions and see if I finally understand how to prepare resource files and get them to work in PB.
I still wish there was some kind of detailed tutorial on this important Windows topic...
(I was not ignoring you or this topic, i was simply under the weather for the past days.)
I'll study your suggestions and see if I finally understand how to prepare resource files and get them to work in PB.
I still wish there was some kind of detailed tutorial on this important Windows topic...
PB Forums : Proof positive that 2 heads (or more...) are better than one 

Re: WINDOWS issue : How do you include icons into the exe ?
You already have me stalled

Could you be more vague ?

What type of file should that be ?
A text file ? An icon file ? What should the file be or contain ?
Thanks for reminding me of the existence of Resource Hacker.
I had forgotten about the very existence of that excellent and most useful helper program.
I refreshed it.
PB Forums : Proof positive that 2 heads (or more...) are better than one 

Re: WINDOWS issue : How do you include icons into the exe ?
exe,dll,ocx,res,cpl,ax,scr,aplBlue wrote: Thu Apr 04, 2024 3:38 am A text file ? An icon file ? What should the file be or contain ?
Re: WINDOWS issue : How do you include icons into the exe ?
On the topic of resource files...
Perhaps this will help you get started.
Help with ressources files (.RC)
Ressources Files
Perhaps this will help you get started.
Help with ressources files (.RC)
Ressources Files
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
Re: WINDOWS issue : How do you include icons into the exe ?
Ah ! Now I understand. Thank you AZJIO for being specific and a lot clearer.
PB Forums : Proof positive that 2 heads (or more...) are better than one 

Re: WINDOWS issue : How do you include icons into the exe ?
Excellent link, Axolotl. Much appreciated.Axolotl wrote: Thu Apr 04, 2024 1:56 pm On the topic of resource files...
Perhaps this will help you get started.
Help with ressources files (.RC)
Ressources Files
But pay attention to this all important detail : searching the forum for resource will NOT find ressource...
CORRECTION : Sorry Axolotl. After reading the post you referenced, I realize that you're not the one that used ressource for resource. Apologies...
PB Forums : Proof positive that 2 heads (or more...) are better than one 

Re: WINDOWS issue : How do you include icons into the exe ?
yes, what can i write.... I hadn't started the topic or wrote resources with two s's.
that's why I - personally - always try different spellings
I'm certainly pleased if I was able to help.
EDIT: written before your correction and apology not needed.

that's why I - personally - always try different spellings
I'm certainly pleased if I was able to help.
EDIT: written before your correction and apology not needed.
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
Re: WINDOWS issue : How do you include icons into the exe ?
To include icons in your exe icon resource,Blue wrote: Sun Mar 31, 2024 5:39 pm That does not make the icon visible so that you can assign specific icons to specific filetypes.
create a .rc file (ex: Icons\Icon.rc) with notepad and with for example:
Code: Select all
1 ICON "Icons/ICON1.ico"
100 ICON "Icons/ICON100.ico"
For the file association, it can be done with cmd:
Code: Select all
; Needs Compile Request Administrator mode
RunProgram("cmd.exe", "/c Assoc .icef=IceForm&&Ftype IceForm="+#DQUOTE$+"%ProgramFiles%\PureBasic\Tools\IceDesign.exe"+#DQUOTE$+" "+#DQUOTE$+"%1"+#DQUOTE$, "", #PB_Program_Wait | #PB_Program_Hide)
HKCR\IceForm\DefaultIcon, Default REG_SZ = "C:\Program Files\PureBasic\Tools\IceDesign.exe,1"
Re: WINDOWS issue : How do you include icons into the exe ?
Thanks, ChrisR for the best — and most complete — explanation I’ve had so far.
The fog is dissipating.
As we say where I live, I catch quickly, as long as you explain lengthily.
The fog is dissipating.
As we say where I live, I catch quickly, as long as you explain lengthily.
PB Forums : Proof positive that 2 heads (or more...) are better than one 

Re: WINDOWS issue : How do you include icons into the exe ?
If your task is to create a library of icons for file extensions, then another option will be easier.
1. The new version of "Resource Hacker" has a menu item "Create an empty script" that allows you to save the DLL. Specify extension when saving.
2. The old version of the program allows you to add resources using a script
CMD file for launching DLL build script
The new version can do it too, but it needs to be studied, the behavior has changed and I couldn’t do some things, so I suggest doing it using the old 3.4.0.79
3. You can look at my program Recovery_associative_icons, which in the source code shows how to assemble icons in dll. I wrote it on WinXP, but I also tried it on Win10.
Also have a look at my ContMenuFiles program
1. The new version of "Resource Hacker" has a menu item "Create an empty script" that allows you to save the DLL. Specify extension when saving.
2. The old version of the program allows you to add resources using a script
Code: Select all
[FILENAMES]
Exe=Recovery_associative_icons.dll
SaveAs=Recovery_associative_icons.dll
Log=Recovery_associative_icons.log
[COMMANDS]
-addoverwrite Recovery_associative_icons.ico, IconGroup,99,
-addoverwrite 1.ico, IconGroup,201,
-addoverwrite 2.ico, IconGroup,202,
-addoverwrite 3.ico, IconGroup,203,
Code: Select all
REM @echo off
color 3b
echo.
"%~dp0ResHacker.exe" -script Recovery_associative_icons_modify_script.txt
pause
3. You can look at my program Recovery_associative_icons, which in the source code shows how to assemble icons in dll. I wrote it on WinXP, but I also tried it on Win10.
Also have a look at my ContMenuFiles program