|
-
April 27th, 2010, 02:33 PM
#1
Passing 64bit int via Windows message
I need to send a private message from a control class back to my main window via PostMessage. This message needs to carry a 64bit int value that indicates the current position of the control. (it's a video control) The catch is that I'm pretty sure that WPARAM and LPARAM are both 32bit types, so I think I need to split the 64bit value between the two params and then recombine them in the message handler. Does that sound like the right way to handle this? If so how do you split a 64bit value between two 32bit params? If not how else would you handle it?
Thanks,
Dan
-
April 27th, 2010, 03:20 PM
#2
Re: Passing 64bit int via Windows message
You could split the value, using masking and shifting. Or, you can just allocate a 64 bit integer on the heap; pass the pointer to your main window; and release the memory in your message handler.
Viggy
-
April 27th, 2010, 03:20 PM
#3
Re: Passing 64bit int via Windows message
Do you mean "SendMessage" or PostMessage?
If former - then the size of the buffer to send doesn't matter - you can pass a pointer to this buffer as either WPARAM or LPARAM.
If latter - then in the case of "64bit int value" there is an obvious solution: split it using LARGE_INTEGER (or ULARGE_INTEGER) structure
Victor Nijegorodov
-
April 28th, 2010, 05:04 AM
#4
Re: Passing 64bit int via Windows message
have a look at how the LOWORD() and HIWORD() macro's are defined for DWORD->WORD and you can do the same for UINT64->DWORD
the reverse (2 WORD -> 1 DWORD) is done with the MAKELONG() macro, making a MAKEUINT64() would be analogous
-
April 28th, 2010, 02:09 PM
#5
Re: Passing 64bit int via Windows message
Thanks guys. I got it working using LARGE_INTEGER.
Dan
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|