Send a message to a control and retrieve information in lParam.
GUICtrlRecvMsg ( controlID , msg [, wParam [, lParamType]] )
| 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. |
| Success: | Returns the value returned by the SendMessage Windows API. |
| Failure: | Returns 0. |
#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
GUICreate("My GUI") ; will create a dialog box that when displayed is centered
Local $nEdit = GUICtrlCreateEdit("line 0", 10, 10)
GUICtrlCreateButton("Ok", 20, 200, 50)
GUISetState()
For $n = 1 To 5
GUICtrlSetData($nEdit, @CRLF & "line " & $n)
Next
; Run the GUI until the dialog is closed
Do
Local $msg = GUIGetMsg()
If $msg > 0 Then
Local $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