Thread overview
application icon
Mar 13, 2013
Gimsom
Mar 13, 2013
Adam D. Ruppe
Mar 13, 2013
Andrej Mitrovic
March 13, 2013
Hi, I would like to set an icon for my D2 application but I have
no idea how to do that, could somone explain me? Thanks.
March 13, 2013
On Wednesday, 13 March 2013 at 12:59:57 UTC, Gimsom wrote:
> Hi, I would like to set an icon for my D2 application but I have
> no idea how to do that, could somone explain me? Thanks.

Create the .ico file and put it in your project folder. Then make a resource file:

whatever_name.rc

with just one line of content:

IDI_ICON1       ICON    DISCARDABLE     "iconfil.ico"


Then, when you build the program, run rcc on this:

\dm\dm\bin\rcc.exe whatever_name.rc

rcc.exe is included in this download: http://ftp.digitalmars.com/bup.zip

It will make a .res file for you.

Then build the exe like so:

\dmd\windows\bin\dmd app.d whatever_name.res

and your exe should show the icon.




While you're at it, if you want to prevent the text console window from appearing when you run the program, you can make a file called "whatever_name.def" with these two lines:

EXETYPE NT
SUBSYSTEM WINDOWS


and then add it to the compile line too. So you end up with a build process of:

\dm\dm\bin\rcc.exe whatever_name.rc
\dmd\windows\bin\dmd app.d [also list your other .d files...] whatever_name.res whatever_name.def


and you have an exe together with icon and no console.
March 13, 2013
On 3/13/13, Adam D. Ruppe <destructionator@gmail.com> wrote:
> Then make a resource file:

Also there's this resource guide: http://www.prowiki.org/wiki4d/wiki.cgi?D__Tutorial/WindowsResources

It should be ported to the new wiki some time.