首页 > 其他分享 >Receive double value in WndProc from legacy

Receive double value in WndProc from legacy

时间:2023-04-16 22:16:40浏览次数:42  
标签:WndProc sheet Receive double share post data se

Receive double value in WndProc from legacy

Ask Question Asked 9 years, 8 months ago Modified 9 years, 1 month ago Viewed 158 times  

I'm trying to send double/float values from my MFC legacy code to WPF window. WPF WndProc procedure receives the arugments in LParam and WParam as ints (truncates the decimal values).

private IntPtr WndProc(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)

How can I do this?

Thanks in advance

Share Edit   asked Jul 29, 2013 at 4:56 WAQ's user avatar WAQ 2,51066 gold badges4242 silver badges8585 bronze badges Add a comment

1 Answer

Reset to default 1  

You could create a structure to store your float/double values and pass the address of that structure in the lParam value. If you are Posting the message rather than Sending it, you will need to get the recipient to free the memory occupied by the structure.

#define MYMESSAGECODE (WM_APP + 123 )
typedef struct
{
    float f;
    double d;
} MyDataStruct;

MyDataStruct data;
data.f = 1.0;
data.d = 2.0;
pWpfWnd->SendMessage( MYMESSAGECODE, 0, (LPARAM) &data );
Share Edit   answered Feb 24, 2014 at 11:31 Adrian Bhagat's user avatar Adrian Bhagat 1043

标签:WndProc,sheet,Receive,double,share,post,data,se
From: https://www.cnblogs.com/ioriwellings/p/17324199.html

相关文章

  • Java中的long与double的区别
    1.long与double在java中本身都是用64位存储的,但是他们的存储方式不同,导致double可储存的范围比long大很多2.long可以准确存储19位数字,而double只能准备存储16位数字(实际测试,是17位,)。double由于有exp位,可以存16位以上的数字,但是需要以低位的不精确作为代价。如果一个大于17位的lo......
  • Java_Double&BigDecimal
    importjava.math.BigDecimal;importjava.math.MathContext;publicclassBigDecimalTest{/***@paramargs*@referencearchie2010*@function实现将double类型的值转换为BigDecimal类型的值的不同途径以及各途径间的区别*......
  • PostCSS received undefined instead of CSS string
    今天在运行之前写的vue的demo时,因为之前引用了scss,而后又因为我将node升级了,scss出现了问题。报错PostCSSreceivedundefinedinsteadofCSSstring解决方案去重新加载一个版本[email protected]在运行了一下项目,结果出现sass与当前node环境不一致的情况Node......
  • UVa 113 / POJ 2109 Power of Cryptography (使用double处理大整数&泰勒公式与误差分
    113-PowerofCryptographyTimelimit:3.000secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=99&page=show_problem&problem=49http://poj.org/problem?id=2109题意:给出n和p,求出 ,但是p可以很大()如何存储p?不用大数可不可以?先看看double......
  • 【Service & BroadcastReceiver相关】
    android开发中如何实现开机自启动http://gundumw100.iteye.com/blog/906188监听应用程序安装和卸载http://zhangkun716717-126-com.iteye.com/blog/1192479使用service定期执行一个服务http://gundumw100.iteye.com/blog/896880利用BroadcastReceive......
  • 《Mysql基础》【Mysql小数浮点数】double float decimal数据类型 编程入门 学习分享
    -- --mysql数据库程序设计笔记:-------------小数测试--------------------double浮点小数(最多小数位后15位,)使用8个字节存储。--float单精度小数:(最多小数位后6位)使用4个字节存储。--举例保留2位:float(18,2),或:double(20,2)--decimal(最多小数位后30位)(存储空间更优,更小,......
  • Float 或者 Double 除以零不会抛出 java.lang.ArithmeticExceptionL:/by zero 异常
    1.Java的浮点运算是基于IEEE-754标准来的。IEEE-754standardJava'sFloating-PointOperations2.Java语言规范https://docs.oracle.com/javase/specs/jls/se7/html/jls-4.html#jls-4.2.31.0/0=+Infinity-1.0/0=-Infinity0/0=NaN......
  • C/C++ 恨透了 double free or corruption
    *以下内容为本人的学习笔记,如需要转载,请声明原文链接微信公众号「ENG八戒」https://mp.weixin.qq.com/s/IwSVImp5cOB3gZbaf0YiPw写过C/C++的都知道,内存允许程序员自主......
  • vue3报错 Vue received a Component which was made a reactive object.
    报错信息如下:VuereceivedaComponentwhichwasmadeareactiveobject.Thiscanleadtounnecessaryperformanceoverhead,andshouldbeavoidedbymarkingthe......
  • 【git】解决gogs迁移后报错remote: hooks/pre-receive: line 2: /data/gogs/gogs: No
    【gogs迁移后错误提示】remote:hooks/pre-receive:line2:/data/gogs/gogs:NosuchfileordirectoryTohttp://192.168.1.129:53000/yin.xia/sgs-vue.git![rem......