Page 1 sur 1

Local Time

MessagePublié: 05 Nov 2007 à 18:00
par Michael DELIQUE
Code : Tout sélectionner
Public Function GetLocalTime_API As String
   
%REM
'Variables API pour la fonction GetLocalTime_API
Type SYSTEMTIME
   wYear As Integer
   wMonth As Integer
   wDayOfWeek As Integer
   wDay As Integer
   wHour As Integer
   wMinute As Integer
   wSeconde As Integer
   wMilliseconds As Integer
End Type
Declare Function GetLocalTime Lib "kernel32.dll" Alias "GetLocalTime" (lpSystemTime As SYSTEMTIME) As Integer
%END REM
   
   'Déclaration Variable
   Dim SysTime As SYSTEMTIME
   
   On Error Goto ErreurGetLocalTime_API
   
   GetLocalTime SysTime
   
   GetLocalTime_API = Cstr(SysTime.wDay) + "/" +Trim(Cstr(SysTime.wMonth)) + "/" + Trim(Cstr(SysTime.wYear))_
   + Cstr(SysTime.wHour) + ":" +Trim(Cstr(SysTime.wMinute)) + ":" + Trim(Cstr(SysTime.wSeconde))+ ":" + Trim(Cstr(SysTime.wMilliseconds))
   
   Exit Function
ErreurGetLocalTime_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 !"
   GetLocalTime_API = ""
   Exit Function
End Function