Link to home
Start Free TrialLog in
Avatar of minnirok
minnirok

asked on

translate #defines

Hi,

Is there anyway to convert a #define from a string into it's numeric value:

    "SS_BLACKFRAME"

for instance should be intrepreted as whatever ms defined as its real numeric value:

    "SS_BLACKFRAME"  =  SS_BLACKFRAME  =  0x07L

I'm just trying to write a small interpreter, and I don't want to have a function to translate them like:

    int TranslateDefs(CString str)
    {
        if (str == "SS_BLACKFRAME") {
            return 0x07L;
        }
        // etc...
    }

Thank you
Avatar of mahesh1402
mahesh1402
Flag of India image

whats exactly you are looking for ?
#define is Preprocessor directive that means compile time your values will be changes with whatever you define it as.

MAHESH
Avatar of minnirok
minnirok

ASKER

yeah ms must have this someplace, probably in windows.h or something:

    #define SS_BLACKFRAME 0x07L

Now I'm reading a text file that has this on a line:

    "SS_BLACKFRAME"

I want to be able to store the defined value of SS_BLACKFRAME in a DWORD:

    DWORD dwStyle;

    dwStyle = SomeFunkyThingToTurnTheTextRepresentationIntoTheNumericVal("SS_BLACKFRAME");

Thanks
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ok just wanted to see if there was something to already translate. This should work ok though.

Thanks.