Thanks MrCreatoR, I searched for something like GUICtrlSetStyle() but found first _WinAPI_SetWindowLong()...
Here the code with GUICtrlSetStyle():
#include <Constants.au3>
#include <EditConstants.au3>
#include <WinAPI.au3>
#include <GUIConstantsEx.au3>
Global $Data, $Label, $sData, $iExStyle, $iStyle, $hGUI, $hData, $State, $Set
$hGUI = GUICreate("Example", 500, 500)
$Data = GUICtrlCreateEdit("Write something in here and hit lock.", 0, 0, 500, 480)
$hData = GUICtrlGetHandle($Data)
$State = GUICtrlCreateButton("Lock", 0, 480, 500, 20)
GUISetState(@SW_SHOW)
$iStyle = _WinAPI_GetWindowLong($hData, $GWL_STYLE )
$iExStyle = _WinAPI_GetWindowLong($hData, $GWL_EXSTYLE)
$Set = 0
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $State
If $Set = 0 Then
GUICtrlSetStyle($Data, $iStyle + $ES_READONLY)
GUICtrlSetData($State, "Unlock")
$sData = GUICtrlRead($Data)
$Set = 1
ElseIf $Set = 1 Then
GUICtrlSetStyle($Data, $iStyle)
GUICtrlSetData($State, "Lock")
$Set = 0
Else
; _Error()
Exit
EndIf
EndSwitch
WEnd
Br,
UEZ