# Function Reference

GUICtrlRecvMsg

Send a message to a control and retrieve information in lParam.

GUICtrlRecvMsg ( controlID , msg [, wParam [, lParamType]] )

Parameters

controlID | The control identifier (controlID) as returned by a GUICtrlCreate... function.
msg | type of message to be send to the control as defined in the Windows controls documentation.
wParam | [optional] An integer first param to be send to the control.
lParamType | [optional] Define the type of lParam that will be returned: 0 (default) for wParam and lParam, 1 for lParam String, 2 for lParam RECT struct.

Return Value

Success: | Returns the value returned by the SendMessage Windows API.
Failure: | Returns 0.

Remarks

This function allows the sending of special Windows messages directly to the control using the SendMessage API. It is used to enable special control features not available with the simple GUICtrlRead() and GUICtrlSet...() range of functions.
If the wParam and lParamType parameters are not specified then an array of two elements is returned (LPwParam, LPlParam).
The RECT is returned in an array of 4 elements (Left, Top, Right, Bottom).

Related

GUICtrlSendMsg, GUICtrlSet..., GUIGetMsg, GUICtrlRead

Example

#include <GUIConstants.au3>
GUICreate("My GUI") ; will create a dialog box that when displayed is centered
$nEdit = GUICtrlCreateEdit ("line 0", 10,10)
GUICtrlCreateButton ("Ok", 20,200,50)
GUISetState ()
for $n=1 to 5
GUICtrlSetData ($nEdit, @CRLF & "line "& $n)
next
$EM_GETSEL = 0x00B0
; Run the GUI until the dialog is closed
Do
$msg = GUIGetMsg()
if $msg >0 then
$a=GUICtrlRecvMsg($nEdit, $EM_GETSEL)
GUICtrlSetState($nEdit,$GUI_FOCUS) ; set focus back on edit control
; will display the wParam and lParam values return by the control
MsgBox(0,"Current selection",StringFormat("start=%d end=%d", $a[0], $a[1]))
endif
Until $msg = $GUI_EVENT_CLOSE