How do I add an icon to the EXE ?

BlitzPlus Forums/BlitzPlus Programming/How do I add an icon to the EXE ?

tkruk(Posted 2003) [#1]
Just bought BB+
But it seems to be missing something basic.

How do I add an icon to the exe it creates???

Tom


Red(Posted 2003) [#2]
res hacker


tkruk(Posted 2003) [#3]
I tried Reshacker.

Problem is it seems that
there is no icon resource at all.

Is there something wrong with my Blitz??? Its not
making ANY icons.


GfK(Posted 2003) [#4]
BlitzPlus doesn't include an icon when you make executables.

With Win32 EXEs, if there's already an icon there then it can be changed. If there isn't one, then you can't add one.


Anthony Flack(Posted 2003) [#5]
Which is a bit crap really, isn't it? Feature request?


Snarty(Posted 2003) [#6]
Use ResHacker again, this time "correctly" ;)

Open up the EXE in ResHacker, in the "Action" Menu, select "Add new resource". Click the "Open file with new resource..." button. Load up an icon file (.ICO) and type ICON in the "Resource Name" field. Click "Add Resource".

Now.. use "Save As..." and save out the new EXE with a different name (This ensures you don't lose the original).

NOTE: DO NOT UPX the EXE before adding the Icon, this will not work the best at all. Instead UPX after, this will be fine.


Red(Posted 2003) [#7]
res hacker :)
It works with B+

Follow snarty advice


tkruk(Posted 2003) [#8]
Snarty:

You rock.
Thanks...

BTW: I got it to work ok, but when I execute the program
the title bar of the window still does not contain
an icon even though my ICO file has every state saved within.

I'll keep playing with it maybe I messed up somewhere.

Tom.


Snarty(Posted 2003) [#9]
No worries :o)

Anyhow, had a quick play with the API, here's what you can do.
hWND=QueryObject(MainWindow,1)
Icon=LoadIcon(hWND,CurrentDir()+"blankpage.ico",0)
SetClassLong hWND,-14,Icon
Add these commands to the relevant .decls.
.lib "user32.dll"
SetClassLong(hWnd%,nIndex%,Value%) : "SetClassLongA"

.lib "shell32.dll"
LoadIcon%(hWND%,File$,Index%) : "ExtractIconA"

Then you can pop the .ico file you want anywhere you want and load from there. You can also grab from the resource, but this was just a quick way to load a "File" into the current Blitz window.


Akat(Posted 2003) [#10]
reshacker...:)


Rob(Posted 2003) [#11]
Akat, snarty just provided a better solution.


tkruk(Posted 2003) [#12]
Thank You Snarty!!!!


Snarty(Posted 2003) [#13]
No prob Tom,

Just ignore Akat, he prob can't read :o)


Russell(Posted 2003) [#14]
Maybe AppIcon would...<dodges tomatoes>..do the...<runs offstage>...trick! :P

Russell