small medium large xlarge

12 Feb 2012, 03:28
Dat Nguyen (25 posts)

In the file windows_gui.rb of the home_stretch, there are two def_api(s) for the SendMessage:

def_api ‘SendMessage’, [‘L’, ‘L’, ‘L’, ‘P’], ‘L’, :send_with_buffer

def_api ‘SendMessage’, [‘L’, ‘L’, ‘L’, ‘L’], ‘L’

The win32api is: LRESULT WINAPI SendMessage( __in HWND hWnd, __in UINT Msg, __in WPARAM wParam, __in LPARAM lParam );

The only difference between the two def_api(s) is the fourth parameter, one is ‘P’, and the other is ‘L’.

The first def_api is noted as sent_with_buffer. I wonder if that makes the fourth parameter different.

  • Dat
13 Feb 2012, 19:11
Erin Dees (207 posts)

Hi, Dat.

The meanings of the @wParam@ and @lParam@ parameters depend on which Windows message you’re sending. For @WM_GETTEXT@, @lParam@ is a pointer to a buffer to receive the control’s text, so it’s defined in Ruby as @’P’@. For the other Windows messages used in the book, it’s used as a long integer, @’L’@.


You must be logged in to comment