Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to catch absent disk error on aDir()?
Message
 
 
To
20/03/2012 06:14:48
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2003
Database:
MS SQL Server
Miscellaneous
Thread ID:
01538758
Message ID:
01538763
Views:
57
See if http://www.berezniker.com/content/pages/visual-foxpro/enumerate-available-drives can help

>I have a routine to pull my pictures out of the memory card(s), and have got one of the card readers for that. The trouble is that the reader presents five disks - for five possible slots that it has, not just the one slot with a card in it. Since the drive letters frequently change on my machine (don't ask), I just try a few usual suspects, and then add one more to the code if it wasn't in the list already.
>
>The dialog I get says "There is no disk in the drive. Please insert a disk into drive ." (with the space before the period!), "Cancel/Try again/Continue". The caption is "Windows - No Disk" (should I conclude that this is actually a published text, as it has this Heading Case In The Caption?). The icon is a red 3d circle with a white X on it. It is not a messagebox, probably because of custom set of buttons, so ctrl+c won't copy the text. The dialog doesn't take focus, so I have to hunt it across monitors and keep clicking. If I click a few times on the "Try again" it may jump to the other monitor.
>
>The line where it happens is an aDir() call with the full path of the folder where I expect the pictures, something like g:\DCIM\100CANON\. I tried to wrap it in a try-catch, but it doesn't fire. The result of the aDir() is zero, the array isn't created.
>
>Is there a way to detect this condition?
>
>update: using filesystem object works... at least the error is trappable. So this goes before my aDir():
>
	local llOK
>	try
>		oD=ofso.GetFolder(tcFromDir)
>		llOK=.t.
>	catch to loErr
>	endtry
>	if not llOK
>		return
>	endif
>and oFso is created previously in the caller.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform