CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2004
    Posts
    119

    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

  2. #2
    Join Date
    Feb 2002
    Posts
    4,640

    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

  3. #3
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    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

  4. #4
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    4,626

    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

  5. #5
    Join Date
    Mar 2004
    Posts
    119

    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
  •  





Click Here to Expand Forum to Full Width

Featured