Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
StrToFile to create a batch file... Win98 & W2k differen
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00883093
Message ID:
00883119
Vues:
17
>Thanks Sergey.
>
>Excluding the TRY/CATCH/ENDTRY, will that work in VFP6?
>
>Can i expect users running W98, XP, ME, 2k, ... to have filesystemobject available?
>
>
>
Hi Chris,

Here's a version that uses Win API and should work under any Windows version. I throw it together right now so you'll have to do some more testing.
 LPARAMETERS tcFileName, tcCase
LOCAL lcFileName, loFile, llOk, lcNewName
lcFileName = FULLPATH(ALLTRIM(tcFileName))
llOk = .T.
IF FILE(lcFileName)
	
	DO CASE
	CASE UPPER(tcCase) = "L"
		lcNewName = LOWER(lcFileName)
	CASE UPPER(tcCase) = "U"
		lcNewName = UPPER(lcFileName)
	CASE UPPER(tcCase) = "P"
		lcNewName = PROPER(lcFileName)
	OTHERWISE
		llOk = .F.
	ENDCASE
	IF llOk
		DECLARE Long MoveFile IN Kernel32 String, String
		IF MoveFile(lcFileName, lcNewName + ".TEMP") = 0 ;
			OR MoveFile(lcNewName + ".TEMP", lcNewName) = 0
			llOk = .F.
		ENDIF	
	ENDIF	
ELSE	
	llOk = .F.
ENDIF

RETURN llOk
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform