Solved

Delphi Programming question

Posted on 1997-09-05
10
118 Views
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
g:

Does anybody have any code or suggestion.

Thanks in advance.

0
Comment
Question by:dl090597
[X]
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
10 Comments
 
LVL 3

Expert Comment

by:mirek071497
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)

0
 

Author Comment

by:dl090597
ID: 1344139
Mirek,

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 #
0
 

Author Comment

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

0
Technology Partners: 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!

 
LVL 3

Expert Comment

by:mirek071497
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 ?
0
 

Author Comment

by:dl090597
ID: 1344142
Mirek,

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

 
0
 
LVL 3

Expert Comment

by:mirek071497
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- )
0
 
LVL 3

Expert Comment

by:mirek071497
ID: 1344144
Hi
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;
var
  ErrorMode: word;
begin
  { 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);
  try
    { drive 1 = a, 2 = b, 3 = c, etc. }
    if DiskSize(Ord(Drive) - $40) = -1 then

      Result := False
    else
      Result := True;
  finally
    { restore old error mode }
    SetErrorMode(ErrorMode);
  end;
end;

0
 
LVL 3

Expert Comment

by:mirek071497
ID: 1344145
Is this working ?
0
 
LVL 3

Accepted Solution

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

Author Comment

by:dl090597
ID: 1344147
Thanks Mirek
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Intraweb download file link ? 1 184
Convert MS Word document to a PDF file 9 136
Delphi Seattle StructureView color 1 34
Firemonkey Tcameracomponent resultion 1 48
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

738 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