I have a parent dialog box and a child dialog box.when i post message from child to parent using PostMessageW(WM_SMESG,NULL,l_dvalue);where l_Value is double value but when i recieve this message in parent and then i am typcasting like double l_value = (double)lParam;then value in l_value always showing 0.0 but the value isend to parent was 0.5 what is the problem
Share
Casting a double of value 0.5 to integer will be “rounded down”; the decimals are truncated to be more specific. The result of truncating .5 from 0.5 will always be 0. However, lParam is not big enough (32 bit) to hold a double value (64 bit). But, assuming float (32 bit) instead of double, you can do it as follows:
*((long*)(&myFloat))*((float*)(&lParam))Or the C++ way:
*reinterpret_cast<long*>(&myFloat)*reinterpret_cast<float*>(&lParam)