Solved

Delphi Programming question

Posted on 1997-09-05
10
113 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
Comment Utility
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
Comment Utility
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
Comment Utility
Can you elaborate on Solution 1 Point Number 3

0
 
LVL 3

Expert Comment

by:mirek071497
Comment Utility
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
Comment Utility
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 3

Expert Comment

by:mirek071497
Comment Utility
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
Comment Utility
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
Comment Utility
Is this working ?
0
 
LVL 3

Accepted Solution

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

Author Comment

by:dl090597
Comment Utility
Thanks Mirek
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now