Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

SendMessage, WM_COMMAND, hiword loword of wParam ?


  • Please log in to reply
5 replies to this topic
Mr_and_Mrs_D
  • Members
  • 164 posts
  • Last active: May 08 2013 08:09 PM
  • Joined: 19 Dec 2006
What would be the syntax for SendMessage when the message has Hiword and Loword in its wParam ??

SendMessage, 0x111, ????, %hwndcontrol%, A

Thanks for any suggestions !
XP SP3 Pro x32 / 7 x64 Pro - AHK 1.0.48.05

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005
LoWord := 1
HiWord := 2

wParam := MakeLong( LoWord, HiWord ) 
SendMessage, 0x111, %wParam%,0, %hwndcontrol%, A

MakeLong( LoWord, HiWord ) {
 return (HiWord << 16) | (LoWord & 0xffff)
}


:)
kWo4Lk1.png

Mr_and_Mrs_D
  • Members
  • 164 posts
  • Last active: May 08 2013 08:09 PM
  • Joined: 19 Dec 2006
I was about to thank you for your super quick answer and Lo ! You came up with another answer, omg.

Thanks :)
XP SP3 Pro x32 / 7 x64 Pro - AHK 1.0.48.05

Krogdor
  • Members
  • 1391 posts
  • Last active: Jun 08 2011 05:31 AM
  • Joined: 18 Apr 2008

LoWord := 1
HiWord := 2

wParam := MakeLong( LoWord, HiWord ) 
SendMessage, 0x111, %wParam%,0, %hwndcontrol%, A

MakeLong( LoWord, HiWord ) {
 return (HiWord << 16) | (LoWord & 0xffff)
}


How would you do the conversion backwards? The OnMessage for 0x200 (WM_MouseMove) gives the X and Y coords, but as HiWord and LoWord; when I saw this I decided to just use MouseGetPos instead but if I could use it from the system that would be even better.

Seems like I should be able to figure out how to reverse it from the code you posted, but I'm absolutely terrible with bit-wise operations x_x

Edit: Nevermind, managed to figure it out (I think). I have this, and it works for a couple examples, so hopefully it's been done how it should:
MakeShort( Long , ByRef LoWord, ByRef HiWord) {
 LoWord := Long & 0xffff
 HiWord := Long >> 16
}


SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005

managed to figure it out (I think). I have this, and it works for a couple examples, so hopefully it's been done how it should:


That is the correct method and I have been using it for a long time.
HIWORDs and LOWORDs posted by Chris
kWo4Lk1.png

Krogdor
  • Members
  • 1391 posts
  • Last active: Jun 08 2011 05:31 AM
  • Joined: 18 Apr 2008
Yay! I guess I probably should have done a forum search for Hi-/LoWords before just going to MouseGetPos... Ah well. Thanks for the help.