Board index » delphi » Re: Navigate

Re: Navigate


2003-06-24 06:26:08 PM
delphi178
The file cannot be deleted because it is being used by TWebBrowser
control.
 
 

Re: Navigate

John Steed writes:
Quote
The file cannot be deleted because it is being used by TWebBrowser
control.
The browser's access to the file while loading is done in a separate
thread, so Navigate() returns before loading is finished. You have to
wait until the browser has finished loading the document before you try
to delete it:
WebBrowser.Navigate('file://' + FileName);
while WebBrowser.readystate <>READYSTATE_COMPLETE do
Forms.Application.ProcessMessages;
DeleteFile(FileName);