1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40:
| // // Datum, & Uhrzeit // var {$IFDEF DYNAMIC_PCHAR} lpBuf: pchar; iLen: integer; {$ELSE} lpBuf: array[0..MAX_PATH] of char; {$ENDIF}
procedure FormatTime(const wnd: HWND; const st: TSystemTime); begin {$IFDEF DYNAMIC_PCHAR} iLen := GetTimeFormat(LOCALE_USER_DEFAULT,TIME_FORCE24HOURFORMAT, @st,nil,nil,0);
GetMem(lpBuf,iLen); try ZeroMemory(lpBuf,iLen);
if(GetTimeFormat(LOCALE_USER_DEFAULT,TIME_FORCE24HOURFORMAT, @st,nil,lpBuf,iLen) = iLen) then SetWindowText(wnd,lpBuf); finally FreeMem(lpBuf,iLen); end; {$ELSE} ZeroMemory(@lpBuf,sizeof(lpBuf));
if(GetTimeFormat(LOCALE_USER_DEFAULT,TIME_FORCE24HOURFORMAT, @st,nil,lpBuf,sizeof(lpBuf)) = 0) then begin // Format "hh:mm:ss" wird als Alternative benutzt lstrcpy(lpBuf,pchar(Format('%.2d:%.2d:%.2d',[st.wHour,st.wMinute,st.wSecond]))); end;
SetWindowText(wnd,lpBuf); {$ENDIF} end; |