Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / February 2008

Tip: Looking for answers? Try searching our database.

Drive Ready Function

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DosFreak - 26 Feb 2008 18:48 GMT
I downloaded a file manager example with drives being listed and
supposing E: was a cdrom, how do you that e: is ready? is there a win32
function to tell you that it is ready for reading without doing a
physical read, and having it pop up with insert a disk.
Or maybe I have to do it that way.

Marc
Johannes Passing - 27 Feb 2008 10:01 GMT
.Net provides DriveInfo.IsReady for that purpose.

Win32 itself does not provide a specific function for this. A common way
to do such a check (in fact, that is also how DriveInfo.IsReady does it)
is as follows: Call SetErrorMode to disable the disk error dialogs, call
GetFileAttributes on the drive path to do the actual check and finally
reenable error dialogs with SetErrorMode.

Of course, GetFileAttributes may block, so calling it asynchronously
might be agood idea. Furthermore, SetErrorMode has process-wide effects,
so you may run into race conditions here.

--Johannes

> I downloaded a file manager example with drives being listed and
> supposing E: was a cdrom, how do you that e: is ready? is there a win32
> function to tell you that it is ready for reading without doing a
> physical read, and having it pop up with insert a disk.
> Or maybe I have to do it that way.

Signature

Johannes Passing - http://int3.de/


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.