Board index » cppbuilder » RichEdit EFOpenError

RichEdit EFOpenError


2006-03-07 05:33:03 PM
cppbuilder33
Hello.
Every time I invoke RichEdit1->LoadFromFile("MyFile.rct")
after invoking RichEdit1->Print("User1"),
I get the errror EFOpenError with message
"cannot open file MyFile.rct".
However if I invoke RichEdit1->LoadFromFile("MyFile.rct")
any number of times without ever invoking RichEdit1->Print("User1"),
I do not get the error.
Am wondering why the Print() is affecting the LoadFromFile().
Am on a winxp, BCB6 environment and am using the
Ms Office Document Image Writer as the printer.
Please assist me to solve my problem.
Regards,
PK
 
 

Re:RichEdit EFOpenError

PK wrote:
Quote
Every time I invoke RichEdit1->LoadFromFile("MyFile.rct")
after invoking RichEdit1->Print("User1"),
I get the errror EFOpenError with message
"cannot open file MyFile.rct".
Maybe the function creates a temp{*word*203}file somewhere else. After that
the current dir would have changed then.
You are using a relative path in your filename.
Alway use an absolute path. You meant "MyFile.rct" to
be in the same directory as your exe. Then use:
->LoadFromFile ( ExtractFilePath (ParamStr(0)) + "MyFile.rct" );
Hans.
 

Re:RichEdit EFOpenError

PK wrote:
Quote
Every time I invoke RichEdit1->LoadFromFile("MyFile.rct")
after invoking RichEdit1->Print("User1"),
I get the errror EFOpenError with message
"cannot open file MyFile.rct".
You haven't specified a directory path in the call to LoadFromFile().
Is the file "MyFile.rct" in the current working directory?
Quote
Am wondering why the Print() is affecting the LoadFromFile()
Maybe it changes the current working directory?
It is bad practice IMO not to always specify files using a fully
qualified file path for precisely this kind of problem.
--
Andrue Cope [TeamB]
[Bicester, Uk]
info.borland.com/newsgroups/guide.html
 

{smallsort}

Re:RichEdit EFOpenError

Thank you all. I will trying specifying a file path.
Thank you.
PK