简体   繁体   中英

how to have a build-dependent icon in Delphi

Is there a way in Delphi XE5 (and later) to have two different icons based on the build target (eg, 32-bit vs. 64-bit). The customer wants both 32-bit and 64-bit versions installed (there is a single source for both). I would like the application icon for each to be different so as to easily distinguish between the 32-bit and 64-bit.

Assuming you mean the main program icon, you have a few options. Personally I would not let the IDE attempt to manage this since it is not cut out to vary the icon based on platform. So take it out of the control of the IDE.

Create resource scripts for 32 and 64 bit platforms:

32 bit

MAINICON ICON "MyAppIcon32.ico"

64 bit

MAINICON ICON "MyAppIcon64.ico"

Compile and link the resources:

{$IFDEF Win32}
{$R 'MyAppIcon32.res' 'MyAppIcon32.rc'}
{$ENDIF}
{$IFDEF Win64}
{$R 'MyAppIcon64.res' 'MyAppIcon64.rc'}
{$ENDIF}

You will also need to make sure that the .res file that the IDE manages no longer contains an icon.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM