Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Delphi Programming question

Posted on 1997-09-05
10
Medium Priority
?
124 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
  • 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
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!

 
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 150 total points
ID: 1344146
Hi i give you solution ! Whats happened.
0
 

Author Comment

by:dl090597
ID: 1344147
Thanks Mirek
0

Featured Post

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!

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…

926 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