Dear Gurus,
I have create a function which able to return value for variant of variable through a LPVOID parameter function.
But some how it cannot work.
Maybe i have did wrong in some point.
Would like you to help me.
Thanks.
Here is my coding.
Code:
void main()
{
CClassA a;
BOOL bAssign=FALSE;
CString str;
a.GetValue("BOOL", &bAssign);
a.GetValue("STRING", &str);
//i just cannot get the value from class A.
}
CClassA
{
//these are member variable
CString string="Test";
BOOL bAssigned = TRUE;
//class func
void GetValue(CString strType, LPVOID value)
{
if(strType == "BOOL")
{
value = reinterpret_cast<BOOL*>(bAssigned);
}
else if(strType == "STRING")
{
value = string.GetBuffer(string.GetLength());
}
}
}
Is my way correct? if it is wrong kindly point out to me where is my mistake.
Thanks.