Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Checking if a Disk is Write-Protected

Posted on 1999-07-13
4
Medium Priority
?
267 Views
Last Modified: 2010-04-06
howdy folks,

Simply as stated in the question title, I need to know how to check if a diskette in Drive A is write protected or not.

If someone could give an explanation with source (just a simply procedure...nothing elaborate), I'd appreciate it.

thanx

x


BTW...is anyone aware of a function that can convert Hex to integers? I couldnt find anything in the Delphi Help file
0
Comment
Question by:X_Kalibur
[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
4 Comments
 
LVL 1

Accepted Solution

by:
logosapience earned 200 total points
ID: 1388172
try this :

function isDiskProtected : boolean;
var
 f : File;
begin
 try
  AssignFile(F,'a:\temp.tmp');
  rewrite(F);  //try to create a file on the disk
  CloseFile(F);
  Erase(F);
  result:=false; //if it works, the disk isn't write-protected
 except
  result:=true; //if it doesn't, then the disk is write-protected
 end;
end;
 
Hope it helps...
0
 
LVL 1

Author Comment

by:X_Kalibur
ID: 1388173
Logo,

Thanks for the quick response.

I'll give this a shot. :)

-x
0
 
LVL 1

Author Comment

by:X_Kalibur
ID: 1388174
Logo you champion!

I thought that i could use somehting like TRY...EXCEPT, but i'd never done it b4, and i could be bothered to sift through the really **** Delphi 3 Help file.

but your thing worked like a charm

thankx

x
0
 
LVL 1

Author Comment

by:X_Kalibur
ID: 1388175
Logo you champion!

I thought that i could use somehting like TRY...EXCEPT, but i'd never done it b4, and i could be bothered to sift through the really **** Delphi 3 Help file.

but your thing worked like a charm

thankx

x
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
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…
Suggested Courses

688 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