this post was submitted on 25 Aug 2023
13 points (84.2% liked)

No Stupid Questions (Developer Edition)

934 readers
1 users here now

This is a place where you can ask any programming / topic related to the instance questions you want!

For a more general version of this concept check out !nostupidquestions@lemmy.world

Icon base by Lorc under CC BY 3.0 with modifications to add a gradient

founded 1 year ago
MODERATORS
 

I'm aware this has been the case since Windows 3.x, you always need an external program to ensure the executable is created with the icon you want. Why?

Please no mentions of Linux and other OSs, I know it's trivial to do so for them.

all 8 comments
sorted by: hot top controversial new old
[–] YaBoyMax@programming.dev 9 points 1 year ago

The PE format used by Windows stores icons in the binary itself, so modifying them is extremely nontrivial. Compare that to Linux environments, where the icon is typically specified within a .desktop file which is literally just a text file and points to an executable and a separate image file somewhere else on the disk.

As the other commmenter mentioned though, you can do something similar to this on Windows by just adding a shortcut as a level of indirection to the actual program in much the same way as a .desktop file.

[–] Ranslite@feddit.de 8 points 1 year ago (1 children)

Create a shortcut and choose your icon.

[–] ICastFist@programming.dev -1 points 1 year ago (2 children)

I don't want a shortcut, I want the binary with a different icon. Programs compiled "from scratch" don't have an icon and a shortcut is useless when a separate person downloads the binary in "the wrong folder".

[–] FishInABarrel@kbin.social 8 points 1 year ago

Programs compiled “from scratch” don’t have an icon...

As someone that wrote Windows applications for a living, that's wrong. You just have to add a resource file and your icon.

[–] Lmaydev@programming.dev 1 points 1 year ago

You add the icon to resource file when compiling don't you?

I don't remember it being much of a chore. But it's been a while since I created a desktop app.

I'm fairly sure Linux requires a separate file to specify the icon as well doesn't it?

[–] muddybulldog@mylemmy.win 5 points 1 year ago

It’s not that they make it hard, it’s that it’s inherently hard because of the way resources are stored and managed within the binary.

[–] o11c@programming.dev 1 points 1 year ago

There's probably a way to do "specify icon as part of the linker call" which should be easier.