Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Checking for diskettes
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00008888
Message ID:
00008909
Vues:
30
I'm not sure if this will help any, but there is an API call that will supress the "Disk is not in Drive" error message... Example: DECLARE SetErrorMode IN "kernel32.dll" INTEGER SetErrorMode(1) This will turn off any error's about a disk not in the drive...To turn it back on, use SetErrorMode(0) If you add a couple more API's to this, you can have a nice "Floppy Disk Checking" routine, like such: DECLARE SetErrorMode IN "kernel32.dll" INTEGER test DECLARE INTEGER GetLastError IN "Kernel32.dll" DECLARE INTEGER FormatMessage IN "kernel32.dll" INTEGER flags, INTEGER notused, INTEGER error, INTEGER locale, STRING @buffer, INTEGER bufsize, INTEGER notused = SetLastError(0) = SetErrorMode(1) nFiles = ADIR(afiles, "A:\*.*") IF nFiles = 0 nLastError = GetLastError() cError = SPACE(255) = FormatMessage( 4096, 0, nLastError, 0, @cError, 255, 0) cError = ALLTRIM(STRTRAN( cError, CHR(0))) WAIT WINDOW "Error Code: " + ALLTRIM(STR(nLastError)) + CHR(13) + "Error: " + cError = SetErrorMode(1) = SetLastError(0) ENDIF This is just a sample so you can see what kind of error codes you get and what the error message is... you would probably want to do a case stament and then figure out a way to actually format the floppy <g>.... Also, note: this is for NT 4.0 and Win95 only.... HTH, -= Ken =-
kenti@oz.net
kenti@msn.com
kenti001@aol.com
74441.1210@compuserve.com
Microsoft Certified Professional - Visual FoxPro
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform