Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to show result of sys(2023)?
Message
De
21/02/2007 05:29:20
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01197523
Message ID:
01197528
Vues:
19
This message has been marked as a message which has helped to the initial question of the thread.
>The sys(2023) on my pc returns as
>
>c:\docume~1\dmitry~1\locals~1\temp
>
>
>How can I make VFP to get this string fully; that is, without truncating the path to 8 characters for each folder?
>
>Thank you.

Dmitry

There may be other ways, but I find this works
#Define MAX_PATH 260

declare Integer FindFirstFile in Kernel32.dll string @, String @
declare Integer FindClose in Kernel32.dll Integer

?DiskFilename(sys2023))


function	DiskFilename(FileName)
	
	do case
	case ( right(m.FileName,1) == '\' )
		return addbs(DiskFilename(left(m.FileName, len(m.Filename)-1)))
	
	case empty(m.FileName)
		return ''
	
	case ( len(m.FileName) == 2 ) and ( right(m.FileName,1) == ':' )
			return m.Filename	&& win2k gives curdir() for C:
	endcase
	
	local Handle, FindFileData, xxx
	FindFileData = space(4+8+8+8+4+4+4+4+MAX_PATH+14)
	Handle = FindFirstFile(@m.FileName, @m.FindFileData)
	
	if( m.Handle < 0 )
		if( !empty(JustFname(m.Filename)) )
			xxx = JustFname(m.Filename)
		else
			xxx = m.FileName
		endif
	else
		=FindClose(m.Handle)
		
		do case
		case inlist(justfname(m.FileName), '.', '..')
			xxx = justfname(m.FileName)
		
		otherwise
			xxx = substr(m.FindFileData, 45, MAX_PATH)
			xxx = left(m.xxx, at(chr(0), m.xxx)-1)
		endcase
	endif
	

	do case
	case empty(justpath(m.FileName))
		return m.xxx
	case ( justpath(m.FileName) == '\' ) and (left(m.FileName,2) == '\\')	&& unc
		return '\\' + m.xxx
	otherwise
		return addbs(DiskFilename(JustPath(m.FileName))) + m.xxx
	endcase
		
endfunc
*--------------------------------------------------------------------------
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform