Device is not ready.

Hi,

I offer a button in my UI to allow the user to update our software from USB 
stick. I pop up an information box to show that I'm busy reading from the 
disk. If I try and read from a USB stick and then yank the drive out while 
I'm ready, Windows will popup this error box:

---------------------------
Error
---------------------------
The device is not ready.
---------------------------
OK
---------------------------

You have to clear this box before the ModalResult of the information box 
clears the dialog (ie. even though ModalResult is mrOk). Is there any way to 
detect that this error has occured and if so, to automatically clear the box 
(click the "Ok" on the error)?

Thanks,
Alain
0
Alain
7/13/2009 4:34:32 PM
embarcadero.delphi.win32 2183 articles. 0 followers. Follow

1 Replies
831 Views

Similar Articles

[PageSpeed] 47
Get it on Google Play
Get it on Apple App Store

Alain Dekker wrote:

> Hi,
> 
> I offer a button in my UI to allow the user to update our software
> from USB stick. I pop up an information box to show that I'm busy
> reading from the disk. If I try and read from a USB stick and then
> yank the drive out while I'm ready, Windows will popup this error box:
> 
> ---------------------------
> Error
> ---------------------------
> The device is not ready.
> ---------------------------
> OK
> ---------------------------
> 
> You have to clear this box before the ModalResult of the information
> box clears the dialog (ie. even though ModalResult is mrOk). Is there
> any way to detect that this error has occured and if so, to
> automatically clear the box (click the "Ok" on the error)?

"Doctor, my arm hurts when I move it like this:..."

You know the answer, no <g>?

You may be able to avoid the error by using the SetErrorMode API
function:

  var
    oldMode: Cardinal;
  begin
     oldMode := SetErrorMode(SEM_FAILCRITICALERRORS);
     try
       ...access the drive
     finally
       SetErrorMode(oldMode);
     end;

This way the OS should not call up the error box but just makes the
file function you are calling fail. Depending on how you do the file
read this will then either cause an exception or return an error code.

-- 
Peter Below (TeamB)  
Don't be a vampire (http://slash7.com/pages/vampires), 
use the newsgroup archives :
http://codenewsfast.com
http://groups.google.com
0
Peter
7/13/2009 6:22:37 PM
Reply:

Similar Artilces:

Delphi.NET loading Delphi.Win32 Driver
Hi, What I'm trying to do is marshal an array of cardinal (or integer) back into managed memory from a win32 dll. I know how to pass managed memory into a win32 dll {code} var aa : array of Integer; Buffer : IntPtr; begin SetLength(aa,2); aa[0] := 1; aa[1] := 80; if not Supports(ExtractFilePath(Application.ExeName)+'Win32_Library\SDK_Driver.Win32.io', TypeOf(IMyFunctions), MyFunctions) then Exit; //loads the driver into memory. MyFunctions contains the method names found in the SDK_Driver. Buffer := Marshal.AllocHGlobal(2 * {Marshal.SystemDefaultC...

delphi Win32 using delphi .NET dll
Hi, I'm trying to use a delphi.NET dll in delphi.WIN32. I am currently using CodeGear Delphi 2007 with version2(base version) of .NET I can get the dll to import into the WIN32 application the only problem is when i include things such as: "using Classes,DateUtils, SysUtils" in the .NET dll the win32 application will instantly hang when any of the dll functions are called. Any help would be great thanks. Also I have tried this example and it also crashes for me? http://cc.embarcadero.com/Item/22688 -Braden I also found this.. "The problem is that, wehn you instal...

Converting Delphi for Win32 to Delphi .Net(Prism)
Hi, I am currently migrating a project from Delphi for Win32 to Delphi.net. Part of my code currently goes into a directory and pulls out a random file from this directory and loads the contents of the file for me. This code doesn't seem to work in Delphi.Net. It uses PString and a number of functions in SysUtils that don't seem to be present in Delphi.net's SysUtils file. If anyone can help me please, it would be greatly appreciated! Many thanks, Jonathan Mackey Jonathan Mackey a écrit : > I am currently migrating a project from Delphi for Win32 to &...

Migrate from Delphi 2007 for Win32 to Delphi XE
we use Delphi 2007 for Win32 to support legacy (32Bit) OWL-based pascal applications (yes i know it was a mistake not to switch to VCL 15 years ago). could our applications still be opened and compiled with Delphi XE? The existing projects are all plain Pascal-Code, coming back from the times of Turbo Pascal for Windows and later on Borland Pascal. Are there any improvements we could profit from (i.e IDE, Debugger)? Thanks Andrej > {quote:title=Andrej Dimic wrote:}{quote} > could our applications still be opened and compiled with Delphi XE? I'm not sure, but I guess ...

Win32 program: Delphi 7 vs Delphi XE5
How is a D7 Win32 program compared to a Delphi XE5 one in terms of stability and performance? Is Delphi XE5 good enough for a big ERP project with several DLL's and hundreds of units and forms? Thanks in advance Am 26.12.2013 15:02, schrieb lior ilan: > How is a D7 Win32 program compared to a Delphi XE5 one in terms of stability > and performance? > Is Delphi XE5 good enough for a big ERP project with several DLL's and > hundreds of units and forms? > Thanks in advance > Hello, XE5 has increased functionality. Stability seems to be ok for most ...

Win32 Delphi language features introduced since Delphi 7
Hi, Am I right in thinking that the language features introduced since Delphi 7 fall into the categories: a) language features dictated by .Net compatibility. e.g. Namespaces, Inlining, records with methods, operator overloading, pure interfaces, generics, extended RTTI and reflection; b) Unicode strings and supporting procedures? c) 64-bit support What other language features, if any, have been introduced since D7? Had most of the post-D7 languages features, except for generics, Unicode strings, and 64-bit support, been introduced in or before Delphi 2005? How bug-free were ...

After installing Delphi XE6 enterpise: Error adding a device device Manager
Adding Android Devices, the following works in Delphi XE5 I click on Add and entered Device name and selected Android Platform. click on enable orientation selected device background picture.png file entered the following values: left = 10 top = 90 screen size: width = 348 height = 610 status bar: size = 78 Position = bottom Then click Ok I get the following error: Access Violation at address 076BEFAD in module 'DeviceManager200.bpl read of address 00000000. ...

[PATCH] Move Win32 from win32/ext/Win32 to ext/Win32
To compile the Win32 module under both "MSWin32" and "cygwin" the module needs to be moved to the ext/ subdirectory. To preserve the change history this should be done with `p4 integrate`: p4 integrate win32/ext/Win32/... ext/Win32/... p4 delete win32/ext/Win32/... The attached patch then updates Configure to build the module under cygwin only, and updates the MANIFEST. The MSWin32 builds will continue to find the module automatically using the FindExt.pm module. Cheers, -Jan diff -dur bleadperl/Configure bleadnew/Configure --- bleadperl/Conf...

re: [PATCH] Move Win32::* functions from win32/win32.c to ext/Win32/Win32.xs
----=_e3pon25ktlh8mqd3tgjj1tt7en166ucrfq.MFSBCHJLHS Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit > patch2.diff moves the Win32::* functions into the ext/Win32 module and > adds forwarder functions to load the module at runtime on first use: > > static void > forward(pTHX_ const char *function) > { > dXSARGS; > Perl_load_module(aTHX_ PERL_LOADMOD_NOIMPORT, newSVpvn("Win32",5), NULL); > PUSHMARK(SP-items); > call_pv(function, GIMME_V); > } It just occurred to me that Perl_load_modul...

Device not ready error
This is my first post, I hope I'm putting it in the right section....I'm getting the following error and I was wondering if anyone has an suggestions as to what is wrong. This is running off Windows 2000 & IIS 5.0 I think this is the code that's causing the error (How can I tell from the call stack which line of code is causing the error?)Dim enc As Encoding Dim objXMLTW As New XmlTextWriter(("C:\XMLDownloads\customer.xml"), enc) objXMLTW.WriteStartDocument() The code works fine on a Windows XP Pro running IIS 5.1 I look at the stack trace (see below) but it gives me no further...

FileUpload Device Not Ready
Previously the file was created in elements and now it is created in Adobe Premier all the setting are the same.I am trying to upload using an ASP.NET fileupload control a flv file to the file system which has worked previously and nothing has changed.  All permissions on the directory on the server C:\Windows\Temp and the Path had full control permissions.  The web config file has the following setting which would exceed any file size and execute timeouts. Please see below. 1 <httpRuntime 2 executionTimeout="24000" 3 maxRequestLength="209...

Delphi Win32 Inkoverlay
I need to use Inkoverlay for 4 entry fields. Do I need to use 4 separate inkoverlay components? What is the best way to create these in code? I need to know this because sometimes the number of entries can vary from 4 to 10. ...

Delphi (Win32)
Hi all, I am looking for a Delphi/Win32 equivalent of the .Net SqlBulkCopy class... is there something available? Background: I want to load CSV/Text files directly into a DB table. Files have various formats, e.g. field separator, text delimiter etc. TIA, Levend. > Background: I want to load CSV/Text files directly into a DB table. Files have various formats, e.g. field separator, text delimiter etc. What database are you using ? Hi Robert, I am mainly using MS SQL Server. Thus a 1:1 equivalent of .Net SqlBulkCopy is what I am looking for - although I would not complain...

device is not ready error?
i am copy my web project into one system and iam running directly without VisualStudio its running but in one form was not working one dialog box was comming windows intrenet explorer "Device Is Not Ready" .whats the solution? Hi, Based on my understandings, you want to publish the web application to the server. If so, I suggest to confirm whether the application runs well at the localhost at first. Then install the relative .net framework in on the server.  Afterwards, please refer to the following link below for the information about "ASP.NET and IIS C...

Web resources about - Device is not ready. - embarcadero.delphi.win32

Mobile Internet device - Wikipedia, the free encyclopedia
They are designed to provide entertainment, information and location-based services for personal use, rather than for corporate use. They allow ...

Evidence says the Pixel C wasn’t designed to be an Android device
... It almost seemed like the software hadn’t been finished, and the development team held a Reddit AMA in order to try to explain the devices shortcomings. ...

Reduce cable clutter and charge your iOS devices with AllDock
When you have multiple devices that need to be charged regularly, your desk or nightside table can become a cluttered mess of cables, iPhones, ...

Charge eight devices at once with OctoFire
How many devices can you charge at the same time? How about eight? The OctoFire 8-Port Multi USB Charging Station is on sale for $64.99 with ...

People are saying that Google's new tablet computer isn't a good device
Google's Pixel C tablet, which takes it name from the line of high-end Chromebook laptops, has just hit the shelves. The device retails for $499 ...

New device could put the brakes on distracted driving
A tragedy inspired one entrepreneur to invent a technological breakthrough that could combat the dangers of texting and driving

Singaporean students create device to help fight Parkinson's symptoms
Team PD Loggers, a group of students from the National University of Singapore, have invented a device that prevents falls resulting from a Parkinsonian ...

IDG Contributor Network: Those devices hidden in your closet CAN hurt you
... in that closet, which by appearance did not amount to much. After a more detailed review, the closet actually contained eight networked devices, ...

New smart devices store lets you try tomorrow’s hardware today
... employees, announced today that they are launching a brick-and-mortar retail store, dedicated to selling Internet of Things connected devices. ...

Digitimes Research: MR device makers receiving more support from developers, investors
More mixed reality (MR) device makers including Sulon Technologies, Osterhout Design Group (ODG) and Magic Leap have attracted more software ...

Resources last updated: 12/12/2015 12:04:15 PM