Change app icon in Visual Studio 2005?
Asked Answered
C

4

8

I'd like to use a different icon for the demo version of my game, and I'm building the demo with a different build config than I do for the full verison, using a preprocessor define to lockout some content, use different graphics, etc. Is there a way that I can make Visual Studio use a different icon for the app Icon in the demo config but continue to use the regular icon for the full version's config?

Chapell answered 16/9, 2008 at 14:17 Comment(0)
H
8

According to this page you may use preprocessor directives in your *.rc file. You should write something like this

#ifdef _DEMO_VERSION_
IDR_MAINFRAME ICON "demo.ico"
#else
IDR_MAINFRAME ICON "full.ico"
#endif
Headspring answered 16/9, 2008 at 14:25 Comment(2)
You can indeed use preprocessor directives in your rc file. I'd say this is the way to do it. +1Furey
This is the best solution. I didn't realize that it was working at first because explorer cached my icon, so I also discovered that you can set the conditions via that icon properties in the resource viewer.Chapell
W
2

What I would do is setup a pre-build event (Project properties -> Configuration Properties -> Build Events -> Pre-Build Event). The pre-build event is a command line. I would use this to copy the appropriate icon file to the build icon.

For example, let's say your build icon is 'app.ico'. I would make my fullicon 'app_full.ico' and my demo icon 'app_demo.ico'. Then I would set my pre-build events as follows:

Full mode pre-build event:

del app.ico | copy app_full.ico app.ico

Demo mode pre-build event:

del app.ico | copy app_demo.ico app.ico

I hope that helps!

Wismar answered 16/9, 2008 at 14:25 Comment(0)
S
0

This will get you halfway there: http://www.codeproject.com/KB/dotnet/embedmultipleiconsdotnet.aspx

Then you need to find the Win32 call which will set the displayed icon from the list of embedded icons.

Sherfield answered 16/9, 2008 at 14:23 Comment(0)
K
0

I don't know a way in visual studio, because the application settings are bound to the hole project. But a simple way is to use a PreBuild event and copy the app.demo.ico to app.ico or the app.release.ico to app.ico demanding on the value of the key $(ConfigurationName) and refer to the app.ico in your project directory.

Karlkarla answered 16/9, 2008 at 14:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.