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
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
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month10 days, 14 hours left to enroll

631 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