git-svn-id: https://192.168.0.254/svn/Proyectos.AlonsoYSal_FactuGES2/trunk@25 40301925-124e-1c4e-b97d-170ad7a8785b
52 lines
1.0 KiB
ObjectPascal
52 lines
1.0 KiB
ObjectPascal
unit funciones;
|
|
|
|
interface
|
|
|
|
function RtfToText(Cadena: PChar): PChar; cdecl; export;
|
|
|
|
implementation
|
|
|
|
uses
|
|
Forms, Classes, SysUtils, StdCtrls, ComCtrls,
|
|
Menus, Windows;
|
|
|
|
function RtfToText(Cadena: PChar): PChar;
|
|
var
|
|
AStream : TStringStream;
|
|
ARichEdit: TRichEdit;
|
|
begin
|
|
ARichEdit := TRichEdit.CreateParented(HWND_MESSAGE);
|
|
try
|
|
AStream := TStringStream.Create(Cadena);
|
|
try
|
|
ARichEdit.SelectAll;
|
|
ARichEdit.SelText := StrPas(Cadena);
|
|
Result := PChar(ARichEdit.Text);
|
|
finally
|
|
FreeAndNIL(AStream);
|
|
end;
|
|
finally
|
|
FreeAndNIL(ARichEdit);
|
|
end;
|
|
end;
|
|
|
|
{ANTIGUA FUNCION CON FUGA DE MEMORIA
|
|
function RtfToText(Cadena: PChar): PChar;
|
|
var
|
|
AStream : TStringStream;
|
|
ARichEdit: TRichEdit;
|
|
begin
|
|
AStream := TStringStream.Create(Cadena);
|
|
ARichEdit := TRichEdit.CreateParented(HWND(-3));
|
|
try
|
|
ARichEdit.SelectAll;
|
|
ARichEdit.SelText := StrPas(Cadena);
|
|
Result := PChar(ARichEdit.Text);
|
|
finally
|
|
FreeAndNIL(AStream);
|
|
end;
|
|
end;
|
|
}
|
|
|
|
end.
|