Import initial din SVN ROAAUTO/Trunk @HEAD
This commit is contained in:
91
COMUN/programe/outile.prg
Normal file
91
COMUN/programe/outile.prg
Normal file
@@ -0,0 +1,91 @@
|
||||
Define Class oUtile As Custom
|
||||
|
||||
Procedure Init
|
||||
Declare Integer GetShortPathName In Win32API;
|
||||
STRING @lpszLongPath, String @lpszShortPath,;
|
||||
INTEGER cchBuffer
|
||||
Endproc
|
||||
|
||||
Function ShortPath
|
||||
Lparameter tcPath
|
||||
Local lcPath, lcShortName, lnLength, lnResult
|
||||
lcPath = tcPath
|
||||
lcShortName = Space(260)
|
||||
lnLength = Len(lcShortName)
|
||||
lnResult = GetShortPathName(@lcPath, @lcShortName, lnLength)
|
||||
If lnResult = 0
|
||||
Return ""
|
||||
Endif
|
||||
Return Left(lcShortName,lnResult)
|
||||
Endfunc
|
||||
|
||||
Function GetAppStartPath
|
||||
Local lcPath
|
||||
Do Case
|
||||
*** VFP 6 provides ServerName property for COM servers EXE/DLL/MTDLL
|
||||
Case Inlist(Application.StartMode,2,3,5)
|
||||
lcPath = Justpath(Application.ServerName)
|
||||
*!* *** Interactive
|
||||
*!* CASE (Application.StartMode) = 0
|
||||
*!* lcPath = SYS(5) + CURDIR()
|
||||
*** Active Document
|
||||
Case Atc(".APP",Sys(16,0)) > 0
|
||||
lcPath = Justpath(Sys(16,0))
|
||||
*** Standalone EXE or VFP Development
|
||||
Otherwise
|
||||
lcPath = Justpath(Sys(16,0))
|
||||
If Atc("PROCEDURE",lcPath) > 0
|
||||
lcPath = Substr(lcPath,Rat(":",lcPath)-1)
|
||||
Endif
|
||||
Endcase
|
||||
Return Addbs(lcPath)
|
||||
Endfunc
|
||||
|
||||
Procedure lista2array
|
||||
Lparameters tcLISTA,taArray,tcSeparator
|
||||
&& tcLista este un sir de caractere care contine elementele separate prin <;> default
|
||||
&& tarray este vectorul care se completeaza - trebuie dat prin referinta
|
||||
&& tcSeparator separatorul de elemente din tcLista - default este ";" - este optional
|
||||
&& intoarce numarul de elemente gasite
|
||||
&& ex: lnNr = lista2array("ana;are;mere",@alista,";")
|
||||
External Array taArray
|
||||
Local Lclista,lcSeparator,lnNRF,lcF1,i
|
||||
lnNRF = 0
|
||||
Lclista=Allt(tcLISTA)
|
||||
If Parameters()<3 Or Empty(tcSeparator)
|
||||
lcSeparator=";"
|
||||
Else
|
||||
lcSeparator=Alltrim(tcSeparator)
|
||||
Endif
|
||||
|
||||
If Right(Lclista,1)!=lcSeparator
|
||||
Lclista=Lclista+lcSeparator
|
||||
Endif
|
||||
|
||||
lnNRF=Occurs(lcSeparator,Lclista)
|
||||
|
||||
If lnNRF>0
|
||||
Dimension taArray[lnNrf,1]
|
||||
|
||||
For i=1 To lnNRF
|
||||
lcF1=Left(Lclista,At(lcSeparator,Lclista)-1)
|
||||
|
||||
If i!=lnNRF
|
||||
Lclista=Substr(Lclista,At(lcSeparator,Lclista)+1)
|
||||
Endif
|
||||
|
||||
taArray[i]=lcF1
|
||||
Endfor
|
||||
Else
|
||||
lnNRF = 0
|
||||
Endif
|
||||
|
||||
Return lnNRF
|
||||
|
||||
Endproc && lista2array
|
||||
|
||||
Procedure decripteazaParola
|
||||
|
||||
Endproc
|
||||
|
||||
Enddefine
|
||||
Reference in New Issue
Block a user