par Michael DELIQUE » 06 Nov 2007 à 09:01
- Code : Tout sélectionner
Public Function GetDirectorySystem_API As String
%REM
'Varibles API pour la fonction GetDirectorySystem_API
Declare Function GetSystemDirectoryA Lib "Kernel32" Alias "GetSystemDirectoryA" (Byval lpBuffer As String, Byval nSize As Long) As Integer
%END REM
'Déclaration Variables
Dim GetWinDir As String * 127
Dim nbLength As Integer
On Error Goto ErreurGetDirectorySystem_API
nbLength=GetSystemDirectoryA(GetWinDir,127)
If nbLength>0 Then
GetDirectorySystem_API = Trim(Left(GetWinDir,nbLength))+"\"
Else
GetDirectorySystem_API = ""
End If
%REM
Une autre version
Dim Result
Dim sysDir As String
sysDir = Space(144)
Result = GetWinSys(sysDir, 144)
If Result = 0 Then
GetDirectorySystem_APi= "C:\"
Else
GetDirectorySystem_APi = Left(Trim(sysDir),Len(Trim(sysDir))-1) & "\"
End If
%END REM
Exit Function
ErreurGetDirectorySystem_API:
Msgbox "("+Cstr(Getthreadinfo (1))+" Call by "+Cstr(Getthreadinfo(10))+")"+Chr(10)+"Erreur " + Str(Err) + " : "+Chr(10) + Cstr(Error)+". "+Chr(10)+"Ligne N° "+Cstr(Erl),16," ERREUR !"
GetDirectorySystem_API = ""
Exit Function
End Function
Cordialement
Michael (SMS-Phobique)
----------------------------
"La théorie, c'est quand on sait tout et que rien ne fonctionne. La pratique, c'est quand tout fonctionne et que personne ne sait pourquoi."
Albert EINSTEIN