# Function Reference

# _GUICtrlRichEdit_Destroy

Delete the Rich Edit control

#include <GuiRichEdit.au3>
_GUICtrlRichEdit_Destroy ( ByRef $hWnd )

## Parameters

$hWnd | Control ID/Handle to the control

## Return Value

Success: | 1, $hWnd is set to 0.
Failure: | 0 and sets the @error flag to non-zero.
@error: | 1 - attempt to destroy a control belonging to another application

## Remarks

Restricted to only be used on Rich Edit controls created with _GUICtrlRichEdit_Create().

## Related

_GUICtrlRichEdit_Create

## Example

    #include <GUIConstantsEx.au3>
    #include <GuiRichEdit.au3>
    #include <WindowsStylesConstants.au3>

    Example()

    Func Example()
        Local $hGui, $iMsg, $idBtn_DoIt, $hRichEdit
        $hGui = GUICreate("Example (" & StringTrimRight(@ScriptName, StringLen(".exe")) & ")", 320, 350, -1, -1)
        $hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
                BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
        $idBtn_DoIt = GUICtrlCreateButton("Do it", 10, 260, 90, 25)

        GUISetState(@SW_SHOW)

        While True
            $iMsg = GUIGetMsg()
            Select
                Case $iMsg = $GUI_EVENT_CLOSE
                    GUIDelete() ; needed unless script crashes if DoIt as not been pushed
                    Exit
                Case $iMsg = $idBtn_DoIt
                    _GUICtrlRichEdit_Destroy($hRichEdit)
            EndSelect
        WEnd
    EndFunc   ;==>Example