Opening rtf file in Delphi generates error -


i loading richedit file using following code:

richedit1.lines.loadfromfile('xxx.rtf'); 

this works well. when use topendialog this:

with dlgopen if execute richedit1.lines.loadfromfile(filename); 

i run problem. file loads alright leaves following error message on desktop:

error message

i using delphi 2010. rtf file generated using microsoft word 2007 , running win10. how can rid of error message?

if can't prevent previewer lock file want read, work around not loading directly file copy of it.

uses ioutils;  .... .... var tempfile: string; .... if dlgopen.execute begin   tempfile := includetrailingpathdelimiter(tpath.gettemppath) + 'temp.rtf';   copyfile(pchar(dlgopen.filename), pchar(tempfile), false);   richedit1.lines.loadfromfile(tempfile);   deletefile(tempfile); end; 

Comments