Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to catch absent disk error on aDir()?
Message
De
20/03/2012 06:14:48
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
How to catch absent disk error on aDir()?
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2003
Database:
MS SQL Server
Divers
Thread ID:
01538758
Message ID:
01538758
Vues:
89
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.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform