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
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
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 = SomeFunkyThingToTurnTheTex tRepresent ationIntoT heNumericV al("SS_BLA CKFRAME");
Thanks
#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 = SomeFunkyThingToTurnTheTex
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok just wanted to see if there was something to already translate. This should work ok though.
Thanks.
Thanks.
#define is Preprocessor directive that means compile time your values will be changes with whatever you define it as.
MAHESH