Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Delphi Programming question

Posted on 1997-09-05
Last Modified: 2010-04-04
I'am trying to write code to detect if a workstation on a network, can detect if a
drive on our network is still connected and has not been disconnected
due to a lose connection etc.  Then I need some way of allowing my
program to access that drive once the connection has been reconnected.

eg.  If I have a program which is writing data to a network drive g: for
example and the connection is lost e.g. when I the drive g: server goes down.  I need to be able to detect this
problem and write my data to a secondary location.  Then I would like to
be able to check if g: is back on line and then rewrite my data back to

Does anybody have any code or suggestion.

Thanks in advance.

Question by:dl090597
  • 6
  • 4

Expert Comment

ID: 1344138
Solution I

1.You need check errors and you must be able to restart you'r program from good point of work.
2.In Win95 you can run simple program which will try connect to loosed drive in OnTimer proc and When drive is available then rerun you'r pgm.
3.In WinNT you can use simple service with Auditing which rerun you'r program.

Solution II
You can write simple program or service for copying files which will be run at machine Startup, and You'r program will be use this second which get files to own cache and can recopy files after failure.

I can't give you answer because I need more data (System on Server, Client Which program etc)


Author Comment

ID: 1344139

The client's sites I am writing the software for could be any of the following:

Win 3.1.1, Win95 or WinNT 3.51/WinNT 4.0.

The networks will be either WinNT or Novell.

Can you elaborate on Solution 1 Point Number 2 and #

Author Comment

ID: 1344140
Can you elaborate on Solution 1 Point Number 3

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.


Expert Comment

ID: 1344141
Sorry for the long time.

Do you need know how detect if network drive is valid or how to write service and simple program with TTimer ?

Author Comment

ID: 1344142

I need to detect if the network drive is down ie. G:  in my program, recover from this (so my program doesn't crash), and then start writing data to a new location ie. E:.  I would need to constantly check the network drive that went down ie. G:, if it comes back online.  I need to start writing my data back to G:.

I am interest in a solution, that allows me to check if a drive is still connected, if not recover from the error without crashing my program, so I can write my data to a new location


Expert Comment

ID: 1344143
I must try this so good aswer will be after some time, but my first sugesstion is to read IOResult - this need work.( of course with $I- )

Expert Comment

ID: 1344144
This is from borland technical information database. This example is written for floppy drive but works fine with others.
I place this as comment because i don't know if this all what you need.

  PRODUCT  :  Delphi                                 NUMBER  :  2857
  VERSION  :  All
       OS  :  Windows/Win32
     DATE  :  June 1, 1996

    TITLE  :  How to check to see if a drive is ready.

Q:  How can I check to see if there is a disk in the "A" drive
    without an error message box telling you that it is not ready?
A:  The following function accepts a drive letter as a parameter,
    and it will return a boolean value that indicates whether

    or not there is a disk in the drive.
function DiskInDrive(Drive: Char): Boolean;
  ErrorMode: word;
  { make it upper case }
  if Drive in ['a'..'z'] then Dec(Drive, $20);
  { make sure it's a letter }
  if not (Drive in ['A'..'Z']) then
    raise EConvertError.Create('Not a valid drive ID');
  { turn off critical errors }
  ErrorMode := SetErrorMode(SEM_FailCriticalErrors);
    { drive 1 = a, 2 = b, 3 = c, etc. }
    if DiskSize(Ord(Drive) - $40) = -1 then

      Result := False
      Result := True;
    { restore old error mode }


Expert Comment

ID: 1344145
Is this working ?

Accepted Solution

mirek071497 earned 50 total points
ID: 1344146
Hi i give you solution ! Whats happened.

Author Comment

ID: 1344147
Thanks Mirek

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi XE10 Round Image 2 154
how can i search if string exist in array ? 3 63
Base1 Encode/Decode 3 81
CheckListBox usage 3 71
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question