Board index » delphi » Delphi: Cannot read different floppy disks? (Repost)

Delphi: Cannot read different floppy disks? (Repost)

Hello World,

We're developing a Delphi application which needs to read files from different
floppy diskettes.  Here's the situation and problem:

1. It prompts the user to insert disk number one (with error-checking to make
   sure the proper disk was inserted, etc.)
2. Reads and processes the files as required (works fine)
3. Then, it prompts the user to insert disk number two (in the same drive)
4. When trying to read disk two, it bombs with a Windows error message:

        Cannot read from drive A:

This seems to be a Windows-esque problem, because no matter what we do to trap
this error (with all of that {$I-} as well as try .. except blocks, etc.), it
still comes up with this error.

If we insert the first disk back in the drive, the system errors stop and the
program resumes control (saying 'this is not the right disk' etc. etc.).  This
makes us think that somehow Windows doesn't know that we're switching disks,
and still has some kind of connection or link with the previous disk.

Basically, our Delphi apps cannot switch disks?!  Seems like we're missing
something obvious... I wish there was an API call to clear out the Windows
memory buffers or something.  (Same problem happens even without any disk
caching, i.e. no SmartDrive nor Norton Cache, etc.)  We seem to be closing all
of the files properly...

Help?!?

advTHANKSance,
Steve

 

Re:Delphi: Cannot read different floppy disks? (Repost)


Quote
---- You wrote: -----

We're developing a Delphi application which needs to read files from
different
floppy diskettes.  Here's the situation and problem:

1. It prompts the user to insert disk number one (with error-checking to
make
   sure the proper disk was inserted, etc.)
2. Reads and processes the files as required (works fine)
3. Then, it prompts the user to insert disk number two (in the same drive)
4. When trying to read disk two, it bombs with a Windows error message:

        Cannot read from drive A:

This seems to be a Windows-esque problem, because no matter what we do to
trap
this error (with all of that {$I-} as well as try .. except blocks, etc.),
it
still comes up with this error.

----- My lame reply: -----
This could be a hardware problem with the floppy. Some floppies don't send
a proper "disk change" signal to the hardware.  There is an interrupt or
function call you can add to your code to force a re-read of the disk ---
I'll look it up and get back to you.  Also, in WFW, if you have "32-bit
_file_ access" turned on in the Control Panel|386Enh|Virtual Memory, then
you do have some disk caching that might contribute to this problem.

The functions you may be interested in are ROM BIOS functions accessed via
interrupt $13.

1) Get Disk Type: service $15 - this reveals whether the drive is supposed
to detect a change of disks.
2) Disk Change Status: service $16 - this service will allow testing of
whether the hardware actually detects change-of-disk.
3) Reset Disk System : service $0 - this _might_ (aint I a wimp?) solve
the problem by forcing the disk sub-system to assume a new disk is loaded.

For more info, please email me personally at BCSDow...@aol.com, and I will
be glad to provide code snippets to do these functions for you.

Good Luck.
Scott

Re:Delphi: Cannot read different floppy disks? (Repost)


In article <3trm7m$...@newsbf02.news.aol.com> (10 Jul 1995 12:58:30 -0400), BCS Dowlen (bcsdow...@aol.com) wrote:
Quote
: >---- You wrote: -----

: >We're developing a Delphi application which needs to read files from
: >different
: >floppy diskettes.  Here's the situation and problem:

: >1. It prompts the user to insert disk number one (with error-checking to
: >make
: >   sure the proper disk was inserted, etc.)
: >2. Reads and processes the files as required (works fine)
: >3. Then, it prompts the user to insert disk number two (in the same drive)
: >4. When trying to read disk two, it bombs with a Windows error message:

: >        Cannot read from drive A:

: >This seems to be a Windows-esque problem, because no matter what we do to
: >trap
: >this error (with all of that {$I-} as well as try .. except blocks, etc.),
: >it still comes up with this error.

I believe that your problem is in Windows trying to load a program segment
from the floppy disk and not being able to, because the disk has been
removed. Try making sure that every component of your program is on the
hard disk - and then try reading the floppies again (and/or or try making
the code segment FIXED and PERMANENT; {$C xxxx} compiler directive)  

The Chief
---------
Dr. A{*word*73}la A. Olowofoyeku (The African Chief)
E-mail   : la...@keele.ac.uk
Author of: Chief's Installer Pro 1.70 for Windows:
           winner of PC PLUS Magazine Gold Award (April 1995 U.K. edition)
           ftp://ftp.demon.co.uk/pub/ibmpc/windows/chief/pro/cinstp17.zip

Other Threads