Solved

NT|D3:check for removable devices without errors ?

Posted on 1998-03-26
3
180 Views
Last Modified: 2010-04-06
Hi,
I'd like to check if there is a disk in A: without trying to destroy the drive (you see what I mean)
A functon that only try to shortly access the drive.
I don't want the msg: no disk in drive , cancel ,ignore ,retry
Any hint ?
If you have an idea under 95 I will be interessed too.
0
Comment
Question by:jeurk
[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
3 Comments
 
LVL 1

Accepted Solution

by:
Socrates050697 earned 60 total points
ID: 1360908
use FileExists
e.g

if FileExists('a:\*.*') then
begin
   (disk in drive)
end
else
begin
   (no disk in drive or disk not formatted)
end;

This doesn't bring up the Cancel/Retry/Ignore message box.
I've only tried this in Win95, but I don't see why it wouldn't work under NT.

Socrates
0
 
LVL 4

Author Comment

by:jeurk
ID: 1360909
I'll check this out befor grading the answer ;)
CU
0
 
LVL 1

Expert Comment

by:pjdb
ID: 1360910
The code raised an error dialog box "No  disk the reader. Please insert a disk in the drive A:" with buttons  "Abort", "Retry" "Ignore" (i've tranlate them from french) under NT 4. However, it work fine for a CD drive.

Sorry :-(

This one work fine with NT

function DiskInDrive(DrvNum:byte):Boolean;
var
  EMode: Word;
begin
  result:=false;
  EMode:=SetErrorMode(SEM_FAILCRITICALERRORS);
  try
    if DiskSize(DrvNum)<>-1 then
          result:=true;
  finally
    SetErrorMode(EMode);
  end;
end;


JDB
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

695 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