<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v =
"urn:schemas-microsoft-com:vml" xmlns:o =
"urn:schemas-microsoft-com:office:office" xmlns:w =
"urn:schemas-microsoft-com:office:word" xmlns:m =
"http://schemas.microsoft.com/office/2004/12/omml"><HEAD><TITLE>Message</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16640" name=GENERATOR>
<STYLE>@font-face {
        font-family: Cambria Math;
}
@font-face {
        font-family: Calibri;
}
@font-face {
        font-family: Tahoma;
}
@page Section1 {size: 612.0pt 792.0pt; margin: 72.0pt 72.0pt 72.0pt 72.0pt; }
P.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0mm 0mm 0pt; FONT-FAMILY: "Times New Roman","serif"
}
LI.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0mm 0mm 0pt; FONT-FAMILY: "Times New Roman","serif"
}
DIV.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0mm 0mm 0pt; FONT-FAMILY: "Times New Roman","serif"
}
A:link {
        COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlink {
        COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
A:visited {
        COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlinkFollowed {
        COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.EmailStyle17 {
        COLOR: #244061; FONT-FAMILY: "Calibri","sans-serif"; mso-style-type: personal-reply
}
.MsoChpDefault {
        FONT-SIZE: 10pt; mso-style-type: export-only
}
DIV.Section1 {
        page: Section1
}
</STYLE>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></HEAD>
<BODY lang=EN-NZ vLink=purple link=blue bgColor=white>
<DIV dir=ltr align=left><SPAN class=761490902-30062008><FONT face=Arial
color=#0000ff size=2>Not really going to get into the specifics of what's
happening in your particular instances, but another suggestion might be
to make use of the RunOnce key in the Registry to delete files the next
time Windows starts up.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=761490902-30062008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=761490902-30062008><FONT face=Arial
color=#0000ff size=2>See <A
href="http://delphi.about.com/cs/adptips1999/a/bltip0799_3.htm">http://delphi.about.com/cs/adptips1999/a/bltip0799_3.htm</A> for
some sample code.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=761490902-30062008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=761490902-30062008><FONT face=Arial
color=#0000ff size=2>However, IMHO Windows itself doesn't keep files open any
longer than requested (maybe unless they're DLLs or something). If the
file in question is a file opened/used by your application, and Windows tells
you it's in use, then I'd strongly suggest your app hasn't closed and released
the file handle properly.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=761490902-30062008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=761490902-30062008><FONT face=Arial
color=#0000ff size=2>Cheers,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=761490902-30062008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=761490902-30062008><FONT face=Arial
color=#0000ff size=2>C.</FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> delphi-bounces@delphi.org.nz
[mailto:delphi-bounces@delphi.org.nz] <B>On Behalf Of </B>John
Bird<BR><B>Sent:</B> Monday, 30 June 2008 1:37 p.m.<BR><B>To:</B> 'NZ Borland
Developers Group - Delphi List'<BR><B>Subject:</B> Re: [DUG] Delete (File)
Function ?<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=440483700-30062008>I have
come across similar problems on Windows Servers over the years in a couple of
cases:</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=440483700-30062008></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=440483700-30062008>1 -
Data Files (non-database in this case) that have been updated and
finished with and closed may remain open or in use as far as the Server
goes. Sometimes this times out after a few minutes and the file does
become not in use. Sometimes it has to be closed manually on the server
(Control panel/Administrative tools/Shared files/Open Files allows one to
manually browse and close an open connection).</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=440483700-30062008></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=440483700-30062008>Sometimes even more puzzling is a file remaining with a
locked block (a file open for shared read/write) long after the updates have
finished. Same solution.</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=440483700-30062008></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=440483700-30062008>Incidentally I discovered There is a useful Windows
command line variant of the Administrative Tools GUI - </SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=440483700-30062008></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=440483700-30062008>OPENFILES /Disconnect /O Read/Write (+ other
options)<BR></SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=440483700-30062008>but haven't yet have had a chance to find out if
that only deals with files opened from this workstation or for any workstation
or whether it can be used from a workstation to close files on the
server.</DIV></SPAN></FONT>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=440483700-30062008>2 -
Zip file archives that get deleted after a time (usually weeks after
created) sometimes fail to delete - using the same DeleteFile call as you
used. I have not figured out yet why these fail to delete, but they are on
a Windows server again.</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=440483700-30062008></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=440483700-30062008>I am
most interested to hear anyone shed light on this!</SPAN></FONT></DIV>
<DIV class=Section1>
<P class=MsoAutoSig align=left>John</P></DIV></BODY></HTML>