title: Using TRichEdit at runtime without defining a parent
body: <p>I need to use a TRichEdit at runtime to perform the rtf to text conversion as discussed <a href="https://stackoverflow.com/questions/3214281/delphi-best-way-to-convert-rtf-to-text">here</a>. I succeded in doing this but I had to set a dummy form as parent if not I cannot populate the TRichedit.Lines. (Error: parent is missing).
  I paste my funciton below, can anyone suggest a way to avoid to define a parent? Can you also comment on this and tell me if you find a more performant idea?</p>
  
  <p>Note: I need a string, not TStrings as output, this is why it has been designed like this.</p>
  
  <pre><code>function RtfToText(const RTF: string;ReplaceLineFeedWithSpace: Boolean): string;
  var
    RTFConverter: TRichEdit;
    MyStringStream: TStringStream;
    i: integer;
    CustomLineFeed: string;
  
  begin
    if ReplaceLineFeedWithSpace then
      CustomLineFeed := ' '
      else
      CustomLineFeed := #13;
    try
      RTFConverter := TRichEdit.Create(nil);
      try
        MyStringStream := TStringStream.Create(RTF);
        RTFConverter.parent := Form4; // this is the part I don't like
        RTFConverter.Lines.LoadFromStream(MyStringStream);
        RTFConverter.PlainText := True;
        for i := 0 to RTFConverter.Lines.Count - 1 do
        begin
          if i &lt; RTFConverter.Lines.Count - 1 then
            Result := Result + RTFConverter.Lines[i] + CustomLineFeed
            else
            Result := Result + RTFConverter.Lines[i];
        end;
      finally
        MyStringStream.Free;
      end;
    finally
      RTFConverter.Free;
    end;
  
  end;
  </code></pre>
  
  <p><strong>UPDATE</strong>:
  After the answer I updated the function and write it here for reference:</p>
  
  <pre><code>function RtfToText(const RTF: string;ReplaceLineFeedWithSpace: Boolean): string;
  var
    RTFConverter: TRichEdit;
    MyStringStream: TStringStream;
  begin
    RTFConverter := TRichEdit.CreateParented(HWND_MESSAGE);
    try
      MyStringStream := TStringStream.Create(RTF);
      try
        RTFConverter.Lines.LoadFromStream(MyStringStream);
        RTFConverter.PlainText := True;
        RTFConverter.Lines.StrictDelimiter := True;
        if ReplaceLineFeedWithSpace then
          RTFConverter.Lines.Delimiter := ' '
          else
          RTFConverter.Lines.Delimiter := #13;
        Result := RTFConverter.Lines.DelimitedText;
      finally
        MyStringStream.Free;
      end;
    finally
      RTFConverter.Free;
    end;
  end;
  </code></pre>