How to detect in MS CV 2008 code which properties are compiled now?

Posted on 2011-10-20
Last Modified: 2012-05-12
Dear experts!

I’m programmer with 10+ years in business, but new to MS VC ++ 2008. And to his IDE, quite different no matter I come here from Vb6 ad C#. I have a follow question:

My project is ActiveX DLL and I should build Unicode and non Unicode version. I put settings in Properties page of the project – non Unicode under realese and Unicode under Unicode Release . Fine, but the problem comes with a function which have different name for Unicode and non Unicode. Here you the code - it not working but you will get a idea for what I talk about.

      if (release==Unicode) // WHAT TO PUT HERE ???
       HICON hIcon = AfxGetApp()->LoadIconW(IDI_ABOUTDLL);  //- THIS IS UNICODE VERSION      
        HICON hIcon = AfxGetApp()->LoadIcon(IDI_ABOUTDLL);  // THIS IS NON UNICODE VERSION

Other solution is to replace the function LoadIconW and LoadIcon with a function with equal name for Unicode and non unicode. Please help.
Question by:dvplayltd
    LVL 30

    Accepted Solution

    Hi dvplayltd,

    you can use the UNICODE macro which is defined for projects which use unicode, i.e.:
    #ifdef UNICODE
     HICON hIcon = AfxGetApp()->LoadIconW(IDI_ABOUTDLL);  //- THIS IS UNICODE VERSION      

    Open in new window

    Hope that helps,


    Author Closing Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
    This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
    The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
    The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now