Solved

NT|D3:check for removable devices without errors ?

Posted on 1998-03-26
3
179 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
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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 Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

786 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