Delphi

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • Error: -5

    9 answers - 795 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Ask for more info on the error, like window caption, window style,
    context. Use the provided info to guess rather the error is
    externaly-produced (windows produced) or is produced directly by your
    application, using ether ShowMessage or "raise Exception".
    The list of things to do goes on and on for ever Provide more info if
    you need more assistence.
    David J Taylor wrote:
    of my users is getting "Error: -5" messages, and I can't reproduce
    this. It seems to happen during a directory traverse. Anything obvious I
    should be looking for? Does the error ring a bell with anyone?
    Thanks,
    David
    --
    Delphi-Talk mailing list -Delphi-Talk (AT) elists (DOT) org
    Delphi-Talk mailing list -Delphi-Talk (AT) elists (DOT) org
  • No.1 | | 320 bytes | |

    of my users is getting "Error: -5" messages, and I can't reproduce
    this. It seems to happen during a directory traverse. Anything obvious I
    should be looking for? Does the error ring a bell with anyone?

    Thanks,
    David

    Delphi-Talk mailing list -Delphi-Talk (AT) elists (DOT) org
  • No.2 | | 738 bytes | |

    Cosmin Prund wrote:
    Ask for more info on the error, like window caption, window style,
    context. Use the provided info to guess rather the error is
    externaly-produced (windows produced) or is produced directly by your
    application, using ether ShowMessage or "raise Exception".

    The list of things to do goes on and on for ever Provide more info
    if you need more assistence.

    If my own application was raising the error I hope that I would be aware
    of it! It seems to be an S error, and I was asking if anyone had seen
    the same error, rather than asking "how to debug an error". Thanks for
    your input, though.

    David

    Delphi-Talk mailing list -Delphi-Talk (AT) elists (DOT) org
  • No.3 | | 983 bytes | |

    Cosmin Prund wrote:
    Ask for more info on the error, like window caption, window style,
    context. Use the provided info to guess rather the error is
    externaly-produced (windows produced) or is produced directly by your
    application, using ether ShowMessage or "raise Exception".

    The list of things to do goes on and on for ever Provide more info
    if you need more assistence.

    The one place where I think there /might/ be an error is in calling
    FindFirst with a non-existant directory. This is the code, and I don't
    think it should cause the error, but who knows!

    status := FindFirst (filename, faAnyFile, F);
    while status = 0 do
    begin
    sl.Add (F.Name); // sl is a TStringList
    status := FindNext (F);
    end;
    FindClose (F);

    Any question that the FindClose shouldn't be called if the FindFirst
    fails?

    Thanks,
    David

    Delphi-Talk mailing list -Delphi-Talk (AT) elists (DOT) org
  • No.4 | | 1497 bytes | |

    I tried the following code and got no error. Maybe it's not that

    <code>
    var F:TSearchRec;
    status:Integer;
    begin
    status := FindFirst ('&!3485', faAnyFile, F);
    while status = 0 do
    begin
    status := FindNext (F);
    end;
    FindClose (F);
    end.
    </code>

    David J Taylor wrote:
    Cosmin Prund wrote:

    >Ask for more info on the error, like window caption, window style,
    >context. Use the provided info to guess rather the error is
    >externaly-produced (windows produced) or is produced directly by your
    >application, using ether ShowMessage or "raise Exception".
    >>

    >The list of things to do goes on and on for ever Provide more info
    >if you need more assistence.
    >
    >

    The one place where I think there /might/ be an error is in calling
    FindFirst with a non-existant directory. This is the code, and I don't
    think it should cause the error, but who knows!

    status := FindFirst (filename, faAnyFile, F);
    while status = 0 do
    begin
    sl.Add (F.Name); // sl is a TStringList
    status := FindNext (F);
    end;
    FindClose (F);

    Any question that the FindClose shouldn't be called if the FindFirst
    fails?

    Thanks,
    David
    --

    Delphi-Talk mailing list -Delphi-Talk (AT) elists (DOT) org

    Delphi-Talk mailing list -Delphi-Talk (AT) elists (DOT) org
  • No.5 | | 766 bytes | |

    Cosmin Prund wrote:
    I tried the following code and got no error. Maybe it's not that

    <code>
    var F:TSearchRec;
    status:Integer;
    begin
    status := FindFirst ('&!3485', faAnyFile, F);
    while status = 0 do
    begin
    status := FindNext (F);
    end;
    FindClose (F);
    end.
    </code>

    Yes, I would expect that. I'm using Delphi 5, and the source code
    suggests that FindClose checks if F is valid before calling the Windows
    FindClose routine.

    Interestingly, Delphi's DirectoryExists routine doesn't use FindFirst, but
    calls the Windows GetFileAttributes function. I wonder why?

    Cheers,
    David

    Delphi-Talk mailing list -Delphi-Talk (AT) elists (DOT) org
  • No.6 | | 2084 bytes | |

    Dont't know if this was mentioned before but -5 means access denied and
    often occurs if the specified search path does not exist, instead of the -3
    'path not found'

    mfG
    Lode

    Message
    From: "Cosmin Prund" <pcosmin (AT) adicomsoft (DOT) ro>
    To: "Delphi-Talk Discussion List" <delphi-talk (AT) elists (DOT) org>
    Sent: Tuesday, July 11, 2006 3:48 PM
    Subject: Re: Error: -5

    I tried the following code and got no error. Maybe it's not that

    <code>
    var F:TSearchRec;
    status:Integer;
    begin
    status := FindFirst ('&!3485', faAnyFile, F);
    while status = 0 do
    begin
    status := FindNext (F);
    end;
    FindClose (F);
    end.
    </code>

    David J Taylor wrote:
    Cosmin Prund wrote:
    >
    >Ask for more info on the error, like window caption, window style,
    >context. Use the provided info to guess rather the error is
    >externaly-produced (windows produced) or is produced directly by your
    >application, using ether ShowMessage or "raise Exception".
    >>

    >The list of things to do goes on and on for ever Provide more info
    >if you need more assistence.
    >>

    >

    The one place where I think there /might/ be an error is in calling
    FindFirst with a non-existant directory. This is the code, and I don't
    think it should cause the error, but who knows!

    status := FindFirst (filename, faAnyFile, F);
    while status = 0 do
    begin
    sl.Add (F.Name); // sl is a TStringList
    status := FindNext (F);
    end;
    FindClose (F);

    Any question that the FindClose shouldn't be called if the FindFirst
    fails?

    Thanks,
    David
    --

    Delphi-Talk mailing list -Delphi-Talk (AT) elists (DOT) org

    >
    >
    >


    Delphi-Talk mailing list -Delphi-Talk (AT) elists (DOT) org

    Delphi-Talk mailing list -Delphi-Talk (AT) elists (DOT) org
  • No.7 | | 1494 bytes | |

    I have to ask are you trying to extract file properties like file size,
    created/accessed/modified dates/times? If you are -5 is most likely
    telling you that access is denied to those files which occurs when Windows
    thinks a file is in use. I had this problem and had to put "try" and
    "except" around my arguements so thta they would skip the errors when a file
    was inaccessable and retrieve "?" instead of the information I was
    requesting. This happens very often with digital media files (videos, mp3s).

    Si
    Message
    From: "David J Taylor" <david-taylor (AT) blueyonder (DOT) co.uk>
    To: "Delphi-Talk Discussion List" <delphi-talk (AT) elists (DOT) org>
    Sent: Wednesday, July 12, 2006 9:55 AM
    Subject: Re: Error: -5

    Skynet wrote:
    Dont't know if this was mentioned before but -5 means access denied
    and often occurs if the specified search path does not exist, instead
    of the -3 'path not found'

    mfG
    Lode

    No, I don't think that was mentioned. It could certainly happen in this
    case where the program is looking for non-existant directories. However,
    thinking that this might be the case, I added an "if DirectoryExists
    (folder)" before the FindFirst iteration, but that didn't solve the
    problem.

    Thanks,
    David
    --

    Delphi-Talk mailing list -Delphi-Talk (AT) elists (DOT) org

    Delphi-Talk mailing list -Delphi-Talk (AT) elists (DOT) org
  • No.8 | | 648 bytes | |

    Skynet wrote:
    Dont't know if this was mentioned before but -5 means access denied
    and often occurs if the specified search path does not exist, instead
    of the -3 'path not found'

    mfG
    Lode

    No, I don't think that was mentioned. It could certainly happen in this
    case where the program is looking for non-existant directories. However,
    thinking that this might be the case, I added an "if DirectoryExists
    (folder)" before the FindFirst iteration, but that didn't solve the
    problem.

    Thanks,
    David

    Delphi-Talk mailing list -Delphi-Talk (AT) elists (DOT) org
  • No.9 | | 1111 bytes | |

    Kraven wrote:
    I have to ask are you trying to extract file properties like file
    size, created/accessed/modified dates/times? If you are -5 is
    most likely telling you that access is denied to those files which
    occurs when Windows thinks a file is in use. I had this problem and
    had to put "try" and "except" around my arguements so thta they would
    skip the errors when a file was inaccessable and retrieve "?" instead
    of the information I was requesting. This happens very often with
    digital media files (videos, mp3s).

    Si

    Good point - I'm not specifically extracting properties like that,
    although the Delphi/Windows FindFirst and FindNext functions will.

    These files should not be in use, and there are already try/except blocks
    around the code which reads the files.

    The user has now deleted the directories with the problem, so until the
    problem happens again, there's not much more that can be done.

    Thanks to everyone for their help.

    David

    Delphi-Talk mailing list -Delphi-Talk (AT) elists (DOT) org

Re: Error: -5


max 4000 letters.
Your nickname that display:
In order to stop the spam: 1 + 0 =
QUESTION ON "Delphi"

EMSDN.COM