Receive double value in WndProc from legacy
Ask Question Asked 9 years, 8 months ago Modified 9 years, 1 month ago Viewed 158 timesI'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 2,51066 gold badges4242 silver badges8585 bronze badges- 1 See this. May be useful. – Anatoliy Nikolaev Jul 29, 2013 at 5:50
1 Answer
Reset to default 1You 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
1043
标签:WndProc,sheet,Receive,double,share,post,data,se
From: https://www.cnblogs.com/ioriwellings/p/17324199.html