Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > it.comp.lang.visual-basic > #18539
| From | Greg <greg@alicie.com> |
|---|---|
| Newsgroups | it.comp.lang.visual-basic |
| Subject | Re: funzione Dir |
| Date | 2015-10-09 16:19 +0200 |
| Organization | solani.org |
| Message-ID | <mv8idn$eb5$1@solani.org> (permalink) |
| References | <mv3mui$grg$1@solani.org> <4cbc1bla3674309egh2l25i74tbvfiiqm8@4ax.com> |
Il 08/10/15 10:56:17 SB ha scritto:
> Il giorno Wed, 07 Oct 2015 20:05:59 +0200, Greg <greg@alicie.com> ha scritto:
>> Mi sono accorto oggi che la riga:
>> x= Dir("G:\miofile.txt")
>> mi restituisce Vuoto anzichè "" quando il drive non è presente. A cosa
>> potrebbe essere dovuto?
> Ti hanno già risposto sul tipo di dato che restituisce Dir, io invece ti
> consiglio di non usarlo e per verificare l'esistenza di un file uso l'api
> GetFileAttributes, tra l'altro puoi sapere se è una direcory e altre info
> Declare Function GetFileAttributes Lib "kernel32" Alias "GetFileAttributesA"
> (ByVal lpFileName As String) As Long
> Const INVALID_HANDLE_VALUE = -1
> Const FILE_ATTRIBUTE_ARCHIVE = &H20
> Const FILE_ATTRIBUTE_DIRECTORY = &H10
> Const FILE_ATTRIBUTE_HIDDEN = &H2
> Const FILE_ATTRIBUTE_NORMAL = &H80
> Const FILE_ATTRIBUTE_READONLY = &H1
> Const FILE_ATTRIBUTE_SYSTEM = &H4
> Const FILE_ATTRIBUTE_TEMPORARY = &H100
> x& = GetFileAttributes ("G:\miofile.txt")
> If x& > 0 Then MsgBox ("ESISTE")
Ciao SB,
sto provando l'api che mi hai suggerito su due diversi pc, xp e seven
tutti a 32 bit.
Per testare l'esitenza di un file va benissimo, sempre, ma se voglio
testare anche gli attibuti del file (ed evitare cosi anche GetAttr) mi
da risultati diversi:
Dim k as Long
k = GetFileAttributes ("G:\miofile.txt")
su XP mi restituisce 8224 e su Seven 32. Come mai?
--
Greg
Back to it.comp.lang.visual-basic | Previous | Next — Previous in thread | Next in thread | Find similar
funzione Dir Greg <greg@alicie.com> - 2015-10-07 20:05 +0200
Re: funzione Dir "Freccia (VegetaSSj)" <NIENTESPAMfreccia_vegetassj@hotmail.invalid> - 2015-10-07 22:14 +0200
Re: funzione Dir Luca D <antaniserse@yahoo.it> - 2015-10-07 13:21 -0700
Re: funzione Dir "salclem2" <salclem2@yahoo.it> - 2015-10-07 23:27 +0200
Re: funzione Dir SB <stNOOObenevSPAM@tin.it> - 2015-10-08 10:56 +0200
Re: funzione Dir Greg <greg@alicie.com> - 2015-10-08 21:29 +0200
Re: funzione Dir "salclem2" <salclem2@yahoo.it> - 2015-10-08 23:23 +0200
Re: funzione Dir "salclem2" <salclem2@yahoo.it> - 2015-10-08 23:26 +0200
Re: funzione Dir Greg <greg@alicie.com> - 2015-10-08 23:48 +0200
Re: funzione Dir Greg <greg@alicie.com> - 2015-10-09 16:19 +0200
Re: funzione Dir SB <stNOOObenevSPAM@tin.it> - 2015-10-09 16:38 +0200
Re: funzione Dir Greg <greg@alicie.com> - 2015-10-11 00:10 +0200
Re: funzione Dir Greg <greg@alicie.com> - 2015-10-08 13:05 +0200
csiph-web