Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Is a card in the cardreader?
Fri, Dec 23 2011 8:33 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

For a small app I'm writing I'm using GetLogicalDriveStrings to get the removable drives. On one PC with a Technica card reader attached I have a problem. GetLogicalDriveStrings lists F,G,H,I even when there are no cards in the slots.

Is there a way of working out which of them actually have a card in them? What I've tried so far (DirectoryExists, FindFirst) generate a Windows level message which D2006s exception handling doesn't cope with - its not seen as an exception.


Roy Lambert
Fri, Dec 23 2011 9:10 AMPermanent Link

Raul

Team Elevate Team Elevate


I'd suggest using something like GetDiskFreeSpaceEx and then if
FreeAvailable is 0 (or TotalSpace is 0) then there is no media.

Since cardreader shows up as removable media i suggest you call
SetErrorMode(SEM_FAILCRITICALERRORS) to avoid windows showing one those
annoying media not present prompts

Raul

On 12/23/2011 8:33 AM, Roy Lambert wrote:
> Is there a way of working out which of them actually have a card in them? What I've tried so far (DirectoryExists, FindFirst) generate a Windows level message which D2006s exception handling doesn't cope with - its not seen as an exception.
Fri, Dec 23 2011 9:48 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Raul

SetErrorMode(SEM_FAILCRITICALERRORS); was the bit I really needed - never had to do it before so had no idea what to look for. With that bit a simple DirectoryExists gives me what I need.

I posted here in desperation since the dear old cg ngs are down again. Maybe when Tim's got EWB complete we should all get together and produce a nice newsreader (on and off line) for them as a gift <evil grin>


Roy Lambert
Image